2011-09-15 21 views
1

我有一個FxCop 10.0項目,通過FxCop GUI運行良好,但是當我通過FxCopCmd命令行應用程序(我想用作我們自動構建過程的一部分)運行它時,它會生成以下異常 - 顯然在嘗試加載組件。FxCop在命令行中引發異常,但不在GUI中?

<Exception Keyword="CA0001" Kind="Engine"> 
    <Type>System.InvalidOperationException</Type> 
    <ExceptionMessage>Collection was modified; enumeration operation may not execute </ExceptionMessage> 
    <StackTrace> at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) 
    at System.Collections.Generic.List`1.Enumerator.MoveNextRare() 
    at System.Collections.Generic.List`1.Enumerator.MoveNext() 
    at Microsoft.FxCop.Sdk.WeakAssemblyReference.FindMatchingReference(WeakAssemblyReference faRef, AssemblyReferenceCollection references, Hashtable cache) 
    at Microsoft.FxCop.Sdk.WeakAssemblyReference.Initialize() 
    at Microsoft.FxCop.Sdk.FrameworkAssemblies.GetFrameworkAssemblyReference(WeakAssemblyReference&amp; assemblyRef, String assemblyName) 
    at Microsoft.FxCop.Sdk.FrameworkAssemblies.get_SystemCore() 
    at Microsoft.FxCop.Sdk.FrameworkTypes.get_DynamicAttribute() 
    at Microsoft.FxCop.Sdk.INodeWrappers.CCIParameterWrapper.get_DynamicTypes() 
    at Microsoft.FxCop.Sdk.INodeWrappers.CCIParameterWrapper.get_Type() 
    at Microsoft.FxCop.Sdk.NameProviders.NameProvider.WriteCommaSeparatedParameters(INodeCollection`1 parameters) 
    at Microsoft.FxCop.Sdk.NameProviders.NameProvider.WriteMethodParameters(IMethodNode method) 
    at Microsoft.FxCop.Sdk.NameProviders.NameProvider.WriteMethod(IMethodNode method) 
    at Microsoft.FxCop.Sdk.NameProviders.CodeWriter.WriteCore(INode node) 
    at Microsoft.FxCop.Sdk.NameProviders.NameProvider.WriteCore(INode node) 
    at Microsoft.FxCop.Sdk.NameProviders.NameProvider.GetName(INode node) 
    at Microsoft.FxCop.Engines.Introspection.Persistence.GetName(Node node, NameStyle style) 
    at Microsoft.FxCop.Engines.Introspection.BaseVisitor.FindTargetMember(Member member, TargetMemberDictionary targets) 
    at Microsoft.FxCop.Engines.Introspection.LoadVisitor.FindTargetMember(Member member, TargetMemberDictionary targets) 
    at Microsoft.FxCop.Engines.Introspection.BaseVisitor.VisitMembers(MemberCollection members, TargetMemberDictionary targets, Boolean visitNestedTypes) 
    at Microsoft.FxCop.Engines.Introspection.BaseVisitor.VisitType(TypeNode type, TargetType target) 
    at Microsoft.FxCop.Engines.Introspection.LoadVisitor.VisitType(TypeNode type, TargetType target) 
    at Microsoft.FxCop.Engines.Introspection.BaseVisitor.VisitTypes(TypeNodeCollection types, TargetNamespaceDictionary targets) 
    at Microsoft.FxCop.Engines.Introspection.LoadVisitor.VisitModule(ModuleNode module, TargetModule target) 
    at Microsoft.FxCop.Engines.Introspection.BaseVisitor.VisitAssembly(AssemblyNode assembly, TargetFile target) 
    at Microsoft.FxCop.Engines.Introspection.LoadVisitor.VisitAssembly(AssemblyNode assembly, TargetFile target) 
    at Microsoft.FxCop.Engines.Introspection.LoadVisitor.Load(TargetFile target, Boolean buildTree, Boolean queueItems, AssemblyNode loadedAssembly) 
    at Microsoft.FxCop.Engines.Introspection.LoadVisitor.LoadAssemblies(Queue queue, ExceptionCollection exceptions)</StackTrace> 
    </Exception> 

我在Google上找不到任何相關內容,所以有人有任何想法可能會導致這種情況嗎?

回答

1

這是由於試圖在10.0文件上運行FxCop 1.36。我們的單元測試代碼試圖在兩個不同的文件夾中找到FxCop,並且我只更新了其中一個文件夾:(

1

您是否爲UI和命令行運行使用相同的.fxcop項目文件?如果沒有,你可能在FxCop UI設置中禁用了多線程加載?

如果您不確定,最好的辦法可能是嘗試使用禁用多線程加載的.fxcop項目文件來執行命令行運行。

+0

我正在使用相同的項目文件。我將在進入時檢查多線程選項明天的辦公室 –

+0

我試過了,不幸的是它沒有解決它,但它確實使我朝着正確的方向前進! –

相關問題