Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Using v2.6 infered project references causes NCrunch exception
johnmwright
#1 Posted : Monday, April 21, 2014 1:33:13 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/27/2011(UTC)
Posts: 45
Location: Chicago, IL

Thanks: 3 times
Was thanked: 7 time(s) in 6 post(s)
I have a large solution that uses many dll-based (not project-based) assembly references. I excitedly grabbed the new v2.6 build this morning in order to try out the inferred project references support. Unfortunately, when I enable this on my solution (change the "Infer project references using assembly names" to True), I get internal exceptions from NCrunch in several projects (both tests and non-test assemblies):

Quote:

[08:26:32.8991-LocalBuildTask-4] ERROR (Internal): 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 System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
at nCrunch.Core.BuildManagement.BuildEnvironment.Build(SnapshotComponent snapshotComponentToBuild, IList`1 referencedComponents, GridClientId gridClientId, CustomEnvironmentVariable[] customEnvironmentVariables)
at nCrunch.Core.Processing.BuildTaskLogic.DoProcessTaskAndReturnSuccessFlag()
at nCrunch.Core.Processing.TaskLogic.ProcessTaskAndReturnSuccessFlag()
at nCrunch.Client.Processing.LocalProcessingTask.ProcessTaskAndReturnSuccessFlag()
at nCrunch.Client.Processing.ProcessingQueue.#=qtgmBBzjvQuenvycAjq6EQA==(LocalProcessingTask #=qJXDGE9CULxgcfKpGkTRyMA==)


Note that the same assembly that had the above exception message in the Processing Queue shows this warning message in the Tests windows (as expected):
Quote:

It has been detected that this component is referencing assemblies within the build output directories of projects within this solution. It is strongly recommended that assemblies are referenced from a directory location that is not subject to disruption from the build process.

Directly referencing assemblies that are updated, copied or manipulated by the build of projects in this solution will create implicit build dependencies that cannot be tracked by NCrunch or MSBuild. This can result in inconsistent build behaviour patterns and code versioning issues. It can also cause problems when trying to execute a clean build of the solution after it is checked out of a source control system.

The following assembly references have triggered this warning:
C:\Work\XXX\Branches\MyProject\bin\YYY.Common.dll
C:\Work\XXX\Branches\MyProject\bin\YYY.Common.pdb


I currently have four instances of projects with the "An item with the same key has already been added" error. I many more instances of the "Assemblies are being referenced from the build output directories" warnings, so it doesn't appear to be a 1-1 match between the two.
Remco
#2 Posted : Monday, April 21, 2014 10:10:19 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi John,

Thanks for sharing this issue. It looks to me like you may have a project in your solution that has a project reference to another project in your solution, then an assembly reference to an assembly with the same name as this project.

.. Or something structurally similar to this. Basically the use of the infer assembly references setting has caused NCrunch to double-resolve a particular reference.

Would you mind submitting a bug report after NCrunch has finished loading the projects in your solution? The log should be able to help me identify exactly which wires have been crossed.
johnmwright
#3 Posted : Tuesday, April 22, 2014 1:03:29 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/27/2011(UTC)
Posts: 45
Location: Chicago, IL

Thanks: 3 times
Was thanked: 7 time(s) in 6 post(s)
Bug report submitted with the same title as this post.
Remco
#4 Posted : Tuesday, April 22, 2014 1:08:58 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
johnmwright
#5 Posted : Tuesday, April 22, 2014 1:29:32 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/27/2011(UTC)
Posts: 45
Location: Chicago, IL

Thanks: 3 times
Was thanked: 7 time(s) in 6 post(s)
Excellent! The issue is no longer present in the 2.7.0.2 build.

I love this feature. This has been holding back several people where I work who really want to use NCrunch, so I'm excited to get them on this version! Thank you very much for adding this feature and for turning around a fix so fast!
Remco
#6 Posted : Tuesday, April 22, 2014 1:32:21 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Great stuff! Thanks for confirming the fix! I'll go ahead and release 2.7 then :)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.053 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download