Hi Remco.
I've seen this issue posted before (
example) but it is happening for me now with v2.16.0.13 in VS2013.
One of my projects fails to build with:
Code:
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at _Mono.Cecil.MetadataReader.InitializeRanges(Table table, Func`1 get_next)
at _Mono.Cecil.MetadataReader.InitializeCustomAttributes()
at _Mono.Cecil.MetadataReader.ReadCustomAttributes(ICustomAttributeProvider owner)
at _Mono.Cecil.Mixin.<GetCustomAttributes>b__8(ICustomAttributeProvider provider, MetadataReader reader)
at _Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
at _Mono.Cecil.Mixin.GetCustomAttributes(ICustomAttributeProvider self, ModuleDefinition module)
at _Mono.Cecil.AssemblyDefinition.get_CustomAttributes()
at nCrunch.Compiler.StaticManipulation.BuiltAssembly.()
at nCrunch.Compiler.StaticManipulation.BuiltAssembly..ctor(FilePath builtAssemblyFilePath, IList`1 adjustedAssemblyReferences, IDictionary`2 codeFilePathsByWorkspaceFilePath, Boolean instrumentForPerformanceMeasurement, Boolean detectStackOverflow)
at nCrunch.Compiler.RemoteBuildRunner.(ComponentBuildParameters , FilePath , BuildOutput , DirectoryPath[] , FilePath[] )
at nCrunch.Compiler.RemoteBuildRunner.Build(ComponentBuildParameters parameters)
The weird thing is if I edit this project, it seems to be related to a set of partial classes:
Code:
<Compile Include="Module.cs" />
<Compile Include="Module.A.cs">
<DependentUpon>Module.cs</DependentUpon>
</Compile>
<Compile Include="Module.B.cs">
<DependentUpon>Module.cs</DependentUpon>
</Compile>
When I comment out either Module.A.cs part or Module.B.cs part, and disable the related code my project builds correctly.
It doesn't appear to be because of the DependentUpon, as if I remove these lines, it still won't build.
Unfortunately my attempts to reproduce this with a new solution with similar structure failed for some reason, so I can't send you a sample solution.
I've submitted a set of logs (one where I've commented out a module and one where it is broken) for you to take a look at via the
Contact form.
I hope you can provide a fix because NCrunch is awesome :)