Bug 6765 - xbuild crashes if dependency found in more than one reference
Summary: xbuild crashes if dependency found in more than one reference
Status: RESOLVED UPSTREAM
Alias: None
Product: Tools
Classification: Mono
Component: xbuild ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-08-30 15:58 UTC by Stephen McConnel
Modified: 2012-08-31 18:50 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
This prevents the described crash. (934 bytes, patch)
2012-08-30 15:58 UTC, Stephen McConnel
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED UPSTREAM

Description Stephen McConnel 2012-08-30 15:58:30 UTC
Created attachment 2438 [details]
This prevents the described crash.

When resolving references, xbuild always goes through dependencies of explicit references.  The bugfix for 6708 works fine to keep this from confusing the compiler.  However, if the same dependency is found in more than one reference, the program fails with the following stack trace:

/usr/local/lib/mono/3.5/Microsoft.Common.targets: error : Error executing task ResolveAssemblyReference: An element with the same key already exists in the dictionary.
		Error executing task ResolveAssemblyReference: System.ArgumentException: An element with the same key already exists in the dictionary.
		  at System.Collections.Generic.Dictionary`2[System.String,Microsoft.Build.Framework.ITaskItem].Add (System.String key, ITaskItem value) [0x00000] in <filename unknown>:0 
		  at Microsoft.Build.Tasks.ResolveAssemblyReference.ResolveAssemblyFileDependencies (ITaskItem item, System.String parent_copy_local) [0x00000] in <filename unknown>:0 
		  at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute () [0x00000] in <filename unknown>:0 
		  at Microsoft.Build.BuildEngine.TaskEngine.Execute () [0x00000] in <filename unknown>:0 
		  at Microsoft.Build.BuildEngine.BuildTask.Execute () [0x00000] in <filename unknown>:0 

The attached proposed fix prevents this crash.
Comment 1 Stephen McConnel 2012-08-31 18:49:33 UTC
This crash won't happen in the current code.  I missed a detail in looking at the fix for 6708 (which may or may not have been part of that fix).