2013-02-15 87 views
2

在过去几年中,我一直使用Cruise Control .NET持续集成服务器,并且它运行良好。最近,启动WebDashboard后,我开始收到此错误。有没有人有任何建议如何解决这个错误?我在ccnet.cong中犯了些错误吗? TIA。内部错误:项目已添加。键入字典:'tmp'添加密钥:'tmp'

INTERNAL ERROR: Item has already been added. Key in dictionary: 'tmp' Key being added: 'tmp' 
System.ArgumentException: Item has already been added. Key in dictionary: 'tmp' Key being added: 'tmp' 
    at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) 
    at System.Collections.Specialized.StringDictionary.Add(String key, String value) 
    at System.CodeDom.Compiler.Executor.ExecWaitWithCaptureUnimpersonated(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine) 
    at System.CodeDom.Compiler.Executor.ExecWaitWithCapture(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine) 
    at Microsoft.CSharp.CSharpCodeGenerator.Compile(CompilerParameters options, String compilerDirectory, String compilerExe, String arguments, String& outputFile, Int32& nativeReturnValue, String trueArgs) 
    at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames) 
    at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources) 
    at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources) 
    at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources) 
    at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence) 
    at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies) 
    at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence) 
    at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace) 
    at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace) 
    at System.Xml.Serialization.XmlSerializer..ctor(Type type) 
    at ThoughtWorks.CruiseControl.Core.State.FileStateManager.LoadState(TextReader stateFileReader) in C:\Tools\CruiseControl.NET-1.9.1.0.source\project\core\state\FileStateManager.cs:line 111 
    at ThoughtWorks.CruiseControl.Core.State.FileStateManager.LoadState(String project) in C:\Tools\CruiseControl.NET-1.9.1.0.source\project\core\state\FileStateManager.cs:line 95 
    at ThoughtWorks.CruiseControl.Core.IntegrationResultManager.get_CurrentIntegration() in C:\Tools\CruiseControl.NET-1.9.1.0.source\project\core\IntegrationResultManager.cs:line 76 
    at ThoughtWorks.CruiseControl.Core.IntegrationResultManager.get_LastIntegrationResult() in C:\Tools\CruiseControl.NET-1.9.1.0.source\project\core\IntegrationResultManager.cs:line 41 
    at ThoughtWorks.CruiseControl.Core.IntegrationResultManager.get_LastIntegration() in C:\Tools\CruiseControl.NET-1.9.1.0.source\project\core\IntegrationResultManager.cs:line 58 
    at ThoughtWorks.CruiseControl.Core.Project.get_LastIntegration() in C:\Tools\CruiseControl.NET-1.9.1.0.source\project\core\Project.cs:line 1367 
    at ThoughtWorks.CruiseControl.Core.Project.CreateProjectStatus(IProjectIntegrator integrator) in C:\Tools\CruiseControl.NET-1.9.1.0.source\project\core\Project.cs:line 1332 
    at ThoughtWorks.CruiseControl.Core.IntegrationQueueManager.GetProjectStatuses() in C:\Tools\CruiseControl.NET-1.9.1.0.source\project\core\IntegrationQueueManager.cs:line 111 
    at ThoughtWorks.CruiseControl.Core.CruiseServer.<>c__DisplayClasse.<GetProjectStatus>b__d(ServerRequest) in C:\Tools\CruiseControl.NET1.9.1.0.source\project\core\CruiseServer.cs:line 475 
    at ThoughtWorks.CruiseControl.Core.CruiseServer.RunServerRequest(ServerRequest request, Nullable`1 permission, Nullable`1 eventType, Action`1 action) in C:\Tools\CruiseControl.NET-1.9.1.0.source\project\core\CruiseServer.cs:line 1512 

UPDATE: 这里是我对工作的代码 - “行动(要求);”是CruiseServer.cs线1512:

/// <summary> 
    /// Encapsulates the code to process a request. 
    /// </summary> 
    /// <param name="request"></param> 
    /// <param name="permission"></param> 
    /// <param name="eventType"></param> 
    /// <param name="action"></param> 
    /// <returns></returns> 
    private Response RunServerRequest(ServerRequest request, 
     SecurityPermission? permission, 
     SecurityEvent? eventType, 
     Action<ServerRequest> action) 
    { 
     Response response = new Response(request); 
     try 
     { 
      // Validate the request and check the security token 
      ValidateRequest(request); 
      if (permission.HasValue) 
      { 
       CheckSecurity(request.SessionToken, 
        null, 
        permission.Value, 
        eventType); 
      } 

      // Perform the actual action 
      action(request); 
      response.Result = ResponseResult.Success; 
     } 
     catch (Exception error) 
     { 
      // Security exceptions have already been logged, just need to log any other exception 
      if (!(error is SecurityException)) 
      { 
       Log.Warning(error); 
      } 

      // Tell the caller the request failed and include the error message (but not the stack trace!) 
      response.Result = ResponseResult.Failure; 
      response.ErrorMessages.Add(
       new ErrorMessage(
        error.Message, 
        error.GetType().Name)); 
     } 
     return response; 
    } 

这是它结束了的函数去,在那里我则步骤进入“数据= integrationQueueManager ...”:

/// <summary> 
    /// Gets information about the last build status, current activity and project name. 
    /// for all projects on a cruise server 
    /// </summary> 
    public virtual ProjectStatusResponse GetProjectStatus(ServerRequest request) 
    { 
     ProjectStatus[] data = null; 
     ProjectStatusResponse response = new ProjectStatusResponse(RunServerRequest(request, 
      null, 
      null, 
      delegate 
       { 
       data = integrationQueueManager.GetProjectStatuses(); 
       if (request.SessionToken != SecurityOverride.SessionIdentifier) 
       { 
        data = this.FilterProjects(request.SessionToken, data); 
       } 
      })); 
     if (data != null) response.Projects.AddRange(data); 
     return response; 
    } 

接着我踏入“projectStatusList.Add ...”:

/// <summary> 
    /// Gets the project statuses. 
    /// </summary> 
    /// <returns></returns> 
    /// <remarks></remarks> 
    public ProjectStatus[] GetProjectStatuses() 
    { 
     ArrayList projectStatusList = new ArrayList(); 
     foreach (IProjectIntegrator integrator in projectIntegrators) 
     { 
      IProject project = integrator.Project; 
      projectStatusList.Add(project.CreateProjectStatus(integrator)); 
     } 
     return (ProjectStatus[]) projectStatusList.ToArray(typeof (ProjectStatus)); 
    } 

于是最后,应用程序将引发的异常 “变种lastIntegration = this.LastIntegration;”在这个函数:

/// <summary> 
    /// Creates the project status. 
    /// </summary> 
    /// <param name="integrator">The integrator.</param> 
    /// <returns></returns> 
    /// <remarks></remarks> 
    public ProjectStatus CreateProjectStatus(IProjectIntegrator integrator) 
    { 
     var lastIntegration = this.LastIntegration; 
     ProjectStatus status = new ProjectStatus(
      this.Name, 
      this.Category, 
      this.CurrentActivity, 
      lastIntegration.Status, 
      integrator.State, 
      this.WebURL, 
      lastIntegration.StartTime, 
      lastIntegration.Label, 
      lastIntegration.LastSuccessfulIntegrationLabel, 
      this.Triggers.NextBuild, 
      this.CurrentBuildStage(), 
      this.QueueName, 
      this.QueuePriority, 
      this.Parameters); 
     status.Description = this.Description; 
     status.Messages = this.messages.ToArray(); 
     status.ShowForceBuildButton = this.ShowForceBuildButton; 
     status.ShowStartStopButton = this.ShowStartStopButton; 
     return status; 
    } 

当我将鼠标悬停我的鼠标光标移到“VAR lastIntegration = this.LastIntegration”它说:“this.LastIntegration =‘this.LastIntegration’扔类型‘System.ArgumentException’的例外”。非常感谢您的反馈!

+0

罗杰你能证明你有在误差正在发生的事情。如果你不知道哪里有错误被抛出我也建议'Debugging'代码,然后在词典的代码在这里粘贴代码,以便有人可以帮助..'当使用字典时,您会收到错误,因为已经有一个重复的密钥添加到密钥值对中。“ – MethodMan 2013-02-15 17:04:06

回答

2

我在一个用户安装我的程序时遇到同样的问题。原来,这个问题是由Cygwin安装引起的,而不是我的程序。链接在这里。

https://github.com/git-tfs/git-tfs/issues/135

+0

感谢您的建议。我在Windows上运行,并没有任何控制我的工作站上的环境变量。一个曾经能够在visual studio中设置环境(http://stackoverflow.com/questions/100543/how-do-i-set-specific-environment-variables-when-debugging-in-visual-studio),然而,我不明白在visual studio 2010中如何做到这一点。 – Roger 2013-08-13 18:24:50

相关问题