Bug report: ccdocgen crash
-
Dienstag, 10. April 2012 14:23
I'm using VS2010SP1 Microsoft Visual Studio 2010 (10.0.40219.1 SP1Rel) with CC 1.4.50327.0.
If I take this code, paste it into a new class library project, and set "Contract Reference Assembly" to "Build" and check "Emit contracts into XML doc file":
using System.Diagnostics.Contracts; /// <summary> /// /// </summary> public class Base { /// <summary> /// /// </summary> /// <param name="x"></param> public Base(object x) { } } /// <summary> /// /// </summary> public class Derived : Base { /// <summary> /// /// </summary> /// <param name="a"></param> /// <param name="b"></param> public Derived(object a, object b = null) : base(b ?? a) { Contract.Requires(a != null); } }
then I get an error during build like this:
The command ""C:\Program Files\Microsoft\Contracts\Bin\ccdocgen" "@obj\Debug\ClassLibrary2ccdocgen.rsp"" exited with code 1.
Full output looks like this:
ClassLibrary2 -> c:\documents and settings\sacleary\my documents\visual studio 2010\Projects\ClassLibrary2\ClassLibrary2\bin\Debug\ClassLibrary2.dll CCDoc failed with uncaught exception: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Stack trace: at System.ThrowHelper.ThrowArgumentOutOfRangeException() at Microsoft.Cci.MutableContracts.ContractExtractor.ExtractClump(List`1 blockList, Int32 startBlockIndex, Int32 startStmtIndex, Int32 endBlockIndex, Int32 endStmtIndex) at Microsoft.Cci.MutableContracts.ContractExtractor.RewriteChildren(BlockStatement blockStatement) at Microsoft.Cci.MutableCodeModel.CodeRewriter.Rewrite(IBlockStatement block) at Microsoft.Cci.MutableContracts.ContractExtractor.SplitMethodBodyIntoContractAndCode(IBlockStatement blockStatement) at Microsoft.Cci.MutableContracts.ContractExtractor.SplitMethodBodyIntoContractAndCode(IContractAwareHost host, ISourceMethodBody sourceMethodBody, PdbReader pdbReader) at Microsoft.Cci.Contracts.LazyContractExtractor.GetMethodContractFor(Object method) at Microsoft.Cci.Contracts.CodeContractsContractExtractor.GetMethodContractFor(Object method) at Microsoft.Cci.MutableContracts.ContractHelper.GetMethodContractFor(IContractAwareHost host, IMethodDefinition methodDefinition) at CCDoc.CCDocContractHelper.TryGetMethodContract(CodeContractAwareHostEnvironment host, IMethodReference method, IMethodContract& methodContract, DocTracker docTracker) at CCDoc.ContractVisitor.ContractPackager.PackageMethodContracts(IMethodDefinition method, Boolean isPure) at CCDoc.ContractVisitor.Visit(IMethodDefinition methodDefinition) at Microsoft.Cci.MetadataReader.ObjectModelImplementation.MethodDefinition.Dispatch(IMetadataVisitor visitor) at Microsoft.Cci.MetadataTraverser.Traverse(IMethodDefinition method) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 methods) at Microsoft.Cci.MetadataTraverser.TraverseChildren(ITypeDefinition typeDefinition) at CCDoc.ContractTraverser.TraverseChildren(ITypeDefinition typeDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INamedTypeDefinition namedTypeDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INamespaceTypeDefinition namespaceTypeDefinition) at Microsoft.Cci.MetadataTraverser.Traverse(INamespaceTypeDefinition namespaceTypeDefinition) at Microsoft.Cci.MetadataTraverser.Dispatcher.Visit(INamespaceTypeDefinition namespaceTypeDefinition) at Microsoft.Cci.MetadataReader.ObjectModelImplementation.NamespaceType.Dispatch(IMetadataVisitor visitor) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 namespaceMembers) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INamespaceDefinition namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(IUnitNamespace namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(IRootUnitNamespace rootUnitNamespace) at Microsoft.Cci.MetadataTraverser.Traverse(IRootUnitNamespace rootUnitNamespace) at Microsoft.Cci.MetadataTraverser.TraverseChildren(IModule module) at Microsoft.Cci.MetadataTraverser.TraverseChildren(IAssembly assembly) at Microsoft.Cci.MetadataTraverser.Traverse(IAssembly assembly) at Microsoft.Cci.MetadataTraverser.Traverse(IModule module) at CCDoc.CCDoc.GetContracts(Options options, DocTracker docTracker) at CCDoc.CCDoc.RealMain(String[] args) at CCDoc.CCDoc.Main(String[] args) elapsed time: 46.8762ms C:\Program Files\Microsoft\Contracts\MsBuild\v4.0\Microsoft.CodeContracts.targets(611,5): error MSB3073: The command ""C:\Program Files\Microsoft\Contracts\Bin\ccdocgen" "@obj\Debug\ClassLibrary2ccdocgen.rsp"" exited with code 1.-Steve
Programming blog: http://nitoprograms.blogspot.com/
Including my TCP/IP .NET Sockets FAQ
and How to Implement IDisposable and Finalizers: 3 Easy Rules
Microsoft Certified Professional Developer
How to get to Heaven according to the Bible- Typ geändert Mike BarnettMicrosoft Employee, Owner Montag, 16. April 2012 01:50 So it can be assigned
Alle Antworten
-
Mittwoch, 11. April 2012 10:54
We have also encountered problems with the CCDoc component in CC 1.4.50327.0. Needed to disable the "Emit contracts into XML doc file" options for 2 projects (out of +/- 150 projects). Different stack trace however:
CCDoc failed with uncaught exception: An item with the same key has already been added.
Stack trace: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Microsoft.Cci.MutableContracts.CodeContractAwareHostEnvironment.LoadUnitFrom(String location) at Microsoft.Cci.MetadataHostEnvironment.Probe(String probeDir, AssemblyIdentity referencedAssembly) at Microsoft.Cci.MutableContracts.CodeContractAwareHostEnvironment.Probe(String probeDir, AssemblyIdentity referencedAssembly) at Microsoft.Cci.MetadataHostEnvironment.ProbeAssemblyReference(IUnit referringUnit, AssemblyIdentity referencedAssembly) at Microsoft.Cci.MutableContracts.CodeContractAwareHostEnvironment.ProbeAssemblyReference(IUnit referringUnit, AssemblyIdentity referencedAssembly) at Microsoft.Cci.MetadataReaderHost.ResolvingAssemblyReference(IUnit referringUnit, AssemblyIdentity referencedAssembly) at Microsoft.Cci.PeReader.LookupAssembly(IModule referringModule, AssemblyIdentity unifiedAssemblyIdentity) at Microsoft.Cci.MetadataReader.ObjectModelImplementation.AssemblyReference.get_ResolvedAssembly() at Microsoft.Cci.MetadataReader.PEFileToObjectModel.ResolveModuleTypeRefReference(IMetadataReaderNamedTypeReference namedTypeReference) at Microsoft.Cci.MetadataReader.ObjectModelImplementation.TypeRefReference.InitResolvedModuleType() at Microsoft.Cci.MetadataReader.ObjectModelImplementation.TypeRefReference.Microsoft.Cci.ITypeReference.get_ResolvedType() at Microsoft.Cci.MemberHelper.GetImplicitlyOverriddenBaseClassMethod(IMethodDefinition derivedClassMethod, ITypeDefinition baseClass) at Microsoft.Cci.MemberHelper.GetImplicitlyOverriddenBaseClassMethod(IMethodDefinition derivedClassMethod) at CCDoc.ContractVisitor.ContractPackager.PackageMethodContracts(IMethodDefinition method, Boolean isPure) at CCDoc.ContractVisitor.Visit(IPropertyDefinition propertyDefinition) at Microsoft.Cci.MetadataTraverser.Traverse(IPropertyDefinition propertyDefinition) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 properties) at Microsoft.Cci.MetadataTraverser.TraverseChildren(ITypeDefinition typeDefinition) at CCDoc.ContractTraverser.TraverseChildren(ITypeDefinition typeDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INamedTypeDefinition namedTypeDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INamespaceTypeDefinition namespaceTypeDefinition) at Microsoft.Cci.MetadataTraverser.Traverse(INamespaceTypeDefinition namespaceTypeDefinition) at Microsoft.Cci.MetadataTraverser.Dispatcher.Visit(INamespaceTypeDefinition namespaceTypeDefinition) at Microsoft.Cci.MetadataReader.ObjectModelImplementation.NamespaceType.Dispatch(IMetadataVisitor visitor) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 namespaceMembers) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INamespaceDefinition namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(IUnitNamespace namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Traverse(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Dispatcher.Visit(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataReader.ObjectModelImplementation.NestedNamespace.Dispatch(IMetadataVisitor visitor) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 namespaceMembers) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INamespaceDefinition namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(IUnitNamespace namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Traverse(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Dispatcher.Visit(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataReader.ObjectModelImplementation.NestedNamespace.Dispatch(IMetadataVisitor visitor) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 namespaceMembers) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INamespaceDefinition namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(IUnitNamespace namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Traverse(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Dispatcher.Visit(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataReader.ObjectModelImplementation.NestedNamespace.Dispatch(IMetadataVisitor visitor) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 namespaceMembers) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INamespaceDefinition namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(IUnitNamespace namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Traverse(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Dispatcher.Visit(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataReader.ObjectModelImplementation.NestedNamespace.Dispatch(IMetadataVisitor visitor) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 namespaceMembers) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INamespaceDefinition namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(IUnitNamespace namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Traverse(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Dispatcher.Visit(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataReader.ObjectModelImplementation.NestedNamespace.Dispatch(IMetadataVisitor visitor) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 namespaceMembers) at Microsoft.Cci.MetadataTraverser.TraverseChildren(INamespaceDefinition namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(IUnitNamespace namespaceDefinition) at Microsoft.Cci.MetadataTraverser.TraverseChildren(IRootUnitNamespace rootUnitNamespace) at Microsoft.Cci.MetadataTraverser.Traverse(IRootUnitNamespace rootUnitNamespace) at Microsoft.Cci.MetadataTraverser.TraverseChildren(IModule module) at Microsoft.Cci.MetadataTraverser.TraverseChildren(IAssembly assembly) at Microsoft.Cci.MetadataTraverser.Traverse(IAssembly assembly) at Microsoft.Cci.MetadataTraverser.Traverse(IModule module) at CCDoc.CCDoc.GetContracts(Options options, DocTracker docTracker) at CCDoc.CCDoc.RealMain(String[] args) at CCDoc.CCDoc.Main(String[] args)
-
Dienstag, 24. April 2012 13:59
I get the same exception as Stephen Cleary with version 1.4.50327.0 when "Emit contracts into XML doc file" is enabled. I've previously used 1.4.50111.1 and didn't get an exception with that (with the same source code to compile). Btw, where do I get an old setup?
My stack trace is a bit different:
CCDoc failed with uncaught exception: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Stack trace: at System.Collections.Generic.List`1.get_Item(Int32 index) at Microsoft.Cci.MutableContracts.ContractExtractor.ExtractClump(List`1 blockList, Int32 startBlockIndex, Int32 startStmtIndex, Int32 endBlockIndex, Int32 endStmtIndex) at Microsoft.Cci.MutableContracts.ContractExtractor.RewriteChildren(BlockStatement blockStatement) at Microsoft.Cci.MutableCodeModel.CodeRewriter.Rewrite(IBlockStatement block) at Microsoft.Cci.MutableContracts.ContractExtractor.SplitMethodBodyIntoContractAndCode(IBlockStatement blockStatement) at Microsoft.Cci.MutableContracts.ContractExtractor.SplitMethodBodyIntoContractAndCode(IContractAwareHost host, ISourceMethodBody sourceMethodBody, PdbReader pdbReader) at Microsoft.Cci.Contracts.LazyContractExtractor.GetMethodContractFor(Object method) at Microsoft.Cci.Contracts.CodeContractsContractExtractor.GetMethodContractFor(Object method) at CCDoc.CCDocContractHelper.TryGetMethodContract(CodeContractAwareHostEnvironment host, IMethodReference method, IMethodContract& methodContract, DocTracker docTracker) at CCDoc.ContractVisitor.ContractPackager.PackageMethodContracts(IMethodDefinition method, Boolean isPure) at CCDoc.ContractVisitor.Visit(IMethodDefinition methodDefinition) at Microsoft.Cci.MetadataTraverser.Traverse(IMethodDefinition method) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 methods) at Microsoft.Cci.MetadataTraverser.TraverseChildren(ITypeDefinition typeDefinition) at Microsoft.Cci.MetadataTraverser.Traverse(INamespaceTypeDefinition namespaceTypeDefinition) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 namespaceMembers) at Microsoft.Cci.MetadataTraverser.Traverse(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 namespaceMembers) at Microsoft.Cci.MetadataTraverser.Traverse(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 namespaceMembers) at Microsoft.Cci.MetadataTraverser.Traverse(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 namespaceMembers) at Microsoft.Cci.MetadataTraverser.Traverse(INestedUnitNamespace nestedUnitNamespace) at Microsoft.Cci.MetadataTraverser.Traverse(IEnumerable`1 namespaceMembers) at Microsoft.Cci.MetadataTraverser.Traverse(IRootUnitNamespace rootUnitNamespace) at Microsoft.Cci.MetadataTraverser.Traverse(IAssembly assembly) at CCDoc.CCDoc.GetContracts(Options options, DocTracker docTracker) at CCDoc.CCDoc.RealMain(String[] args) at CCDoc.CCDoc.Main(String[] args) elapsed time: 2958,795ms C:\Program Files (x86)\Microsoft\Contracts\MsBuild\v4.0\Microsoft.CodeContracts.targets(611,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft\Contracts\Bin\ccdocgen" "@obj\Release\Domainccdocgen.rsp"" exited with code 1.
-
Montag, 11. Juni 2012 06:19
Any news on this?
Or can we please get at least a download link of version 1.4.50111.1?
-
Montag, 10. September 2012 09:41
This bug still exists in the new version 1.4.50813.1!
New stack strace:
CCDoc failed with uncaught exception: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Stack trace: at System.Collections.Generic.List`1.get_Item(Int32 index) at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index) at VBSourceEmitter.SourceEmitter.TraverseChildren(IMethodCall methodCall) at Microsoft.Cci.CodeTraverser.Traverse(IMethodCall methodCall) at VBSourceEmitter.SourceEmitter.TraverseChildren(IMethodCall methodCall) at Microsoft.Cci.CodeTraverser.Traverse(IMethodCall methodCall) at CCDoc.XContract.WriteVBFromAST(IExpression expression) at CCDoc.XPrecondition.WriteTo(XmlWriter writer) at CCDoc.XmlTraverser.WriteEndElement(XmlReader reader, XmlWriter writer) at CCDoc.XmlTraverserBase.Transform(XmlReader reader, XmlWriter writer) at CCDoc.CCDoc.WriteContracts(IDictionary`2 contracts, Options options, DocTracker docTracker) at CCDoc.CCDoc.RealMain(String[] args) at CCDoc.CCDoc.Main(String[] args) elapsed time: 4859,375ms C:\Program Files (x86)\Microsoft\Contracts\MsBuild\v4.0\Microsoft.CodeContracts.targets(618,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft\Contracts\Bin\ccdocgen" "@obj\Release\Domainccdocgen.rsp"" exited with code 1.
-
Montag, 10. September 2012 17:05Besitzer
I just tried it with the first code sample that was posted on this thread. I am not able to reproduce the problem. We should be publishing a new release today. Please try again after that comes out and let me know if you still have a problem. Best is if you can send me a repro (either small enough to post on a thread or else send it in a zip file).
Mike Barnett
-
Mittwoch, 12. September 2012 16:35Besitzer
We have just put out a new release (v1.4.50910.0) that should fix this problem. Please try it and let us know if it doesn't work for you.Mike Barnett
- Als Antwort vorgeschlagen Mike BarnettMicrosoft Employee, Owner Mittwoch, 12. September 2012 16:35
-
Donnerstag, 13. September 2012 06:10
I'm still getting the same error as in my last post with version 1.4.50910.0.
I'd really like to create a small sample, but I have no idea what exactly causes the exception. This is a huge project with nearly 2000 contracts and the error didn't start at a specific check-in. It started as soon as I updated version 1.4.50111.1 to version 1.4.50327.0.
-
Donnerstag, 13. September 2012 09:25
cremor, you can try to use ccdocgen manually with some command line arguments to get a debug output. It placed in "C:\Program Files (x86)\Microsoft\Contracts\Bin". Execute "ccdocgen /?" to get list of command line options. You should use "-d" option and "-of <fileName>" if I remember correct. If you specify correct options the debug file will be created with names of the processed methods. One of the last (maybe not exactly last one) should be the problem method. You may have to spend some time to exactly detect problem code, but I successfully used this approach to find a problem after upgrade to a new version in a quite big project.
-
Donnerstag, 25. Oktober 2012 08:06
Fixed in 1.4.51019.0, thanks!- Als Antwort vorgeschlagen cremor Donnerstag, 25. Oktober 2012 08:07
- Als Antwort markiert Mike BarnettMicrosoft Employee, Owner Donnerstag, 25. Oktober 2012 17:13

