C# 内部错误:已添加项。输入字典:';tmp&x27;正在添加的键:';tmp&x27;
在过去的几年里,我一直在使用Cruise Control.NET持续集成服务器,它工作得很好。最近,我在启动WebDashboard后开始收到此错误。有人对如何解决这个错误有什么建议吗?我在ccnet.cong中犯了一些错误吗?蒂亚C# 内部错误:已添加项。输入字典:';tmp&x27;正在添加的键:';tmp&x27;,c#,.net,key,hashtable,cruisecontrol,C#,.net,Key,Hashtable,Cruisecontrol,在过去的几年里,我一直在使用Cruise Control.NET持续集成服务器,它工作得很好。最近,我在启动WebDashboard后开始收到此错误。有人对如何解决这个错误有什么建议吗?我在ccnet.cong中犯了一些错误吗?蒂亚 INTERNAL ERROR: Item has already been added. Key in dictionary: 'tmp' Key being added: 'tmp' System.ArgumentException: Item has alrea
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
内部错误:已添加项。字典中的键:“tmp”正在添加的键:“tmp”
System.ArgumentException:已添加项。字典中的键:“tmp”正在添加的键:“tmp”
在System.Collections.Hashtable.Insert(对象键、对象值、布尔添加)
位于System.Collections.Specialized.StringDictionary.Add(字符串键,字符串值)
位于System.CodeDom.Compiler.Executor.ExecWaitWithCaptureUnpersonated(安全用户令牌句柄用户令牌、字符串cmd、字符串currentDir、TempFileCollection tempFiles、字符串和输出名、字符串和错误名、字符串trueCmdLine)
位于System.CodeDom.Compiler.Executor.ExecWaitWithCapture(SafeUserTokenHandle userToken、String cmd、String currentDir、TempFileCollection tempFiles、String&outputName、String&errorName、String trueCmdLine)
在Microsoft.CSharp.CSharpCodeGenerator.Compile(编译器参数选项、字符串编译器目录、字符串编译器执行、字符串参数、字符串和输出文件、Int32和nativeReturnValue、字符串trueArgs)
位于Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(编译器参数选项,字符串[]文件名)
位于Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(编译器参数选项,字符串[]源)
位于Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAsemblyFromSourceBatch(CompilerParameters选项,字符串[]源)
位于System.CodeDom.Compiler.CodeDomProvider.CompileAsemblyFromSource(CompilerParameters选项,字符串[]源)
在System.Xml.Serialization.Compiler.Compile(程序集父级、字符串ns、XmlSerializationrCompilerParameters xmlParameters、证据)
位于System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[]xmlMappings,Type[]types,String defaultNamespace,证据证据,XmlSerializerCompilerParameters参数,程序集,哈希表程序集)
位于System.Xml.Serialization.TempAssembly..ctor(XmlMapping[]xmlMappings,Type[]types,String defaultNamespace,String location,证据)
位于System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping XmlMapping,类型,字符串defaultNamespace)
位于System.Xml.Serialization.XmlSerializer..ctor(类型类型,字符串defaultNamespace)
位于System.Xml.Serialization.XmlSerializer..ctor(类型)
在C:\Tools\CruiseControl.NET-1.9.1.0.source\project\Core\State\FileStateManager.cs中的ThoughtWorks.CruiseControl.Core.State.FileStateManager.LoadState(TextReader stateFileReader)中:第111行
在C:\Tools\CruiseControl.NET-1.9.1.0.source\project\Core\State\FileStateManager.cs中的ThoughtWorks.CruiseControl.Core.State.FileStateManager.LoadState(字符串项目)中:第95行
在C:\Tools\CruiseControl.NET-1.9.1.0.source\project\Core\IntegrationResultManager.cs中的ThoughtWorks.CruiseControl.Core.IntegrationResultManager.get_CurrentIntegration():第76行
在C:\Tools\CruiseControl.NET-1.9.1.0.source\project\Core\IntegrationResultManager.cs中的ThoughtWorks.CruiseControl.Core.IntegrationResultManager.get\u LastIntegrationResult()。第41行
在C:\Tools\CruiseControl.NET-1.9.1.0.source\project\Core\IntegrationResultManager.cs中的ThoughtWorks.CruiseControl.Core.IntegrationResultManager.get_LastIntegration()。第58行
在C:\Tools\CruiseControl.NET-1.9.1.0.source\Project\Core\Project.cs中的ThoughtWorks.CruiseControl.Core.Project.get_LastIntegration()中
在C:\Tools\CruiseControl.NET-1.9.1.0.source\Project\Core\Project.cs中的ThoughtWorks.CruiseControl.Core.Project.CreateProjectStatus(iProjectEntegrator integrator)中:第1332行
在C:\Tools\CruiseControl.NET-1.9.1.0.source\project\Core\IntegrationQueueManager.cs中的ThoughtWorks.CruiseControl.Core.IntegrationQueueManager.GetProjectStatuses()中
在c:\Tools\CruiseControl.NET1.9.1.0.source\project\Core\CruiseServer.cs中的ThoughtWorks.CruiseControl.Core.CruiseServer.c___显示classe.b___d(服务器请求)
在C:\Tools\CruiseControl.NET-1.9.1.0中的ThoughtWorks.CruiseControl.Core.CruiseServer.RunServerRequest(ServerRequest请求,可为null的`1权限,可为null的`1事件类型,操作`1操作)中。source\project\Core\CruiseServer.cs:第1512行
更新:
下面是我正在处理的代码--“操作(请求);”是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;
}
//
///封装代码以处理请求。
///
///
///
///
///
///
专用响应RunServerRequest(ServerRequest请求,
SecurityPermission?许可,
SecurityEvent?事件类型,
行动(行动)
{
响应=新的响应(请求);
尝试
{
//验证请求并检查安全令牌
验证请求(请求);
if(permission.HasValue)
{
检查安全性(request.SessionToken,
无效的
权限。值,
事件类型);
}
//实际行动
行动(请求);
response.Result=ResponseResult.Success;
}
捕获(异常错误)
{
//已记录安全异常,只需记录任何其他异常
如果(!(错误为SecurityException))
{
日志警告(错误);
}
//告诉调用方请求失败并包含错误消息(但不包括堆栈跟踪!)
response.Result=ResponseResult.Failure;
response.ErrorMessages.Add(
新错误消息(
错误消息,
/// <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;
}
/// <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));
}
/// <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;
}