Build/Test Issues

An item with the same key has already been added

Started by chrboum on 7,918 views

I am running NCrunch v2.8.0.1. I have seen this issue posted in the forum before, but I don't appear to have the original author's problem. I reviewed the NCrunch Report.zip logs, and nothing sticks out to me. Any advise on where to look next, or how to debug this issue further?

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.#=qb0akXOvmmpLAjKKWBO4dKQ==(LocalProcessingTask #=q45$lN3wFtvBlp$4hmkwdDg==)
Hi, thanks for sharing this issue.

It looks like NCrunch is being bugged out by either:
1. A source file that has been referenced inside the project twice
2. A project that is being referenced by this project twice

Note that this is a fairly internal problem, so it's quite possible that you don't have duplicate references inside your project and that NCrunch is simply resolving something twice as a result of your project or solution structure. Still, I recommend checking to see if there is any obvious duplication.

Do you also experience this problem for the project when it fails to build? (i.e. if you intentionally break it?)

It would be great if you could share with me a log file leading up to the problem. You're welcome to submit this either via the bug reporter or as an upload through the contact form.

Cheers,

Remco
I just sent a bug report, and referenced this post.

I didn't see 1 or 2, but it was enough to get me unblocked. The project was referencing another project unnecessarily, so I deleted the reference. Once I did, it worked. I sent the logs before I got it to work, so I sent another bug report for completeness in case the logs would help.


Thanks,
Christopher
Excellent! Thanks Christopher. Hopefully with the bug reports I should be able to identify this problem and fix it in a future build.

Post a reply

Log in to reply.