开发者

FxCop throws an exception on the command line, but not in the GUI?

I've an FxCop 10.0 project that runs fine through the FxCop GUI but when I run it throught the FxCopCmd command line app (which I want to use as part of our automated build process) it generates the following exception - apparently while trying to load assemblies.

  <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 n开发者_如何学JAVAode, 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>

I can't find anything revelant on Google, so does anyone have any ideas what might be causing this?


Are you using the same .fxcop project file for the UI and command line runs? If not, have you perhaps disabled multithreaded loading in the FxCop UI settings?

If you're not sure, your best bet would prbably be to try using a .fxcop project file with multithreaded loading disabled for your command line run.


This was due to trying to run FxCop 1.36 on a 10.0 file. Our unit test code tried to find FxCop in two different folders, and I'd only updated one of them :(

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜