Bug 30904 - Compiler crash with Mono 4.0.1 under Ubuntu 14.04
Summary: Compiler crash with Mono 4.0.1 under Ubuntu 14.04
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 4.0.0
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2015-06-08 10:01 UTC by blinke76
Modified: 2015-06-30 05:51 UTC (History)
1 user (show)

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


Attachments
Conveyor.Alignment.Application.Prank assembly source code (320.95 KB, application/gzip)
2015-06-29 08:35 UTC, blinke76
Details
Source code + compiled results incl. all dependencies for the failing unit test library (391.03 KB, application/gzip)
2015-06-29 08:36 UTC, blinke76
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 FIXED

Description blinke76 2015-06-08 10:01:25 UTC
Running xbuild for a larger application many sub projects fails on a recently added unit test project:

....
	Target CoreCompile:
		Tool /usr/lib/mono/4.5/mcs.exe execution started with arguments: /noconfig /debug:full /debug+ /optimize- /out:obj/Debug/PrankTests.dll /resource:obj/Debug/PrankTests.aa_sequences.fas Test.cs /target:library /define:DEBUG /nostdlib /reference:/usr/lib/mono/4.5/System.dll /reference:../../packages/NUnit.2.6.4/lib/nunit.framework.dll /reference:../../packages/log4net.2.0.3/lib/net40-full/log4net.dll /reference:/usr/lib/mono/4.5/System.Core.dll /reference:/homes/blinke/Projects/conveyor/UnitTests/Conveyor.UnitTestUtilities/bin/Debug//Conveyor.UnitTestUtilities.dll /reference:/homes/blinke/Projects/conveyor/Plugins/Conveyor.BioIO/bin/Debug//Conveyor.BioIO.dll /reference:/homes/blinke/Projects/conveyor/Conveyor.Core/Conveyor.Core/bin/Debug//Conveyor.Core.dll /reference:/homes/blinke/Projects/conveyor/Conveyor.Core/Conveyor.List/bin/Debug//Conveyor.List.dll /reference:/homes/blinke/Projects/conveyor/Plugins/Conveyor.Alignment/bin/Debug//Conveyor.Alignment.dll /reference:/homes/blinke/Projects/conveyor/Plugins/Conveyor.BioinformaticTypes/bin/Debug//Conveyor.BioinformaticTypes.dll /reference:/homes/blinke/Projects/conveyor/Plugins/Conveyor.Annotation/bin/Debug//Conveyor.Annotation.dll /reference:/homes/blinke/Projects/conveyor/Staging/Conveyor.Alignment.Application.Prank/bin/Debug//Conveyor.Alignment.Application.Prank.dll /reference:/homes/blinke/Projects/conveyor/Conveyor.Core/Conveyor.Text/bin/Debug//Conveyor.Text.dll /reference:/homes/blinke/Projects/conveyor/Conveyor.Core/Conveyor.Math/bin/Debug//Conveyor.Math.dll /reference:/homes/blinke/Projects/conveyor/Conveyor.Core/Conveyor.Logic/bin/Debug//Conveyor.Logic.dll /reference:/homes/blinke/Projects/conveyor/Conveyor.Core/Conveyor.Pair/bin/Debug//Conveyor.Pair.dll /reference:/homes/blinke/Projects/conveyor/Plugins/Conveyor.QualitySequence/bin/Debug//Conveyor.QualitySequence.dll /reference:/homes/blinke/Projects/conveyor/CeBiTec/CeBiTec.Batch/bin/Debug//CeBiTec.Batch.dll /reference:/homes/blinke/Projects/conveyor/CeBiTec/CeBiTec.Settings/bin/Debug//CeBiTec.Settings.dll /reference:/homes/blinke/Projects/conveyor/CeBiTec/CeBiTec.Batch.Local/bin/Debug//CeBiTec.Batch.Local.dll /reference:/usr/lib/mono/4.5/mscorlib.dll /warn:4
		Unhandled Exception:
		System.ArgumentException: An item with the same key has already been added.
		  at System.ThrowHelper.ThrowArgumentException (ExceptionResource resource) [0x00000] in <filename unknown>:0 
		  at System.Collections.Generic.Dictionary`2[IKVM.Reflection.TypeName,IKVM.Reflection.Type].Insert (TypeName key, IKVM.Reflection.Type value, Boolean add) [0x00000] in <filename unknown>:0 
		  at System.Collections.Generic.Dictionary`2[IKVM.Reflection.TypeName,IKVM.Reflection.Type].Add (TypeName key, IKVM.Reflection.Type value) [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Reader.ModuleReader.PopulateTypeDef () [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Reader.ModuleReader.FindType (TypeName typeName) [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Reader.AssemblyReader.FindType (TypeName typeName) [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Assembly.GetType (System.String name, Boolean throwOnError, Boolean ignoreCase) [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Assembly.GetType (System.String name, Boolean throwOnError) [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Assembly.GetType (System.String name) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.StaticLoader.HasObjectType (IKVM.Reflection.Assembly assembly) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.AssemblyReferencesLoader`1[IKVM.Reflection.Assembly].LoadReferencesCore (Mono.CSharp.ModuleContainer module, IKVM.Reflection.Assembly& corlib_assembly, System.Collections.Generic.List`1& loaded) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.StaticLoader.LoadReferences (Mono.CSharp.ModuleContainer module) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 
		[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: An item with the same key has already been added.
		  at System.ThrowHelper.ThrowArgumentException (ExceptionResource resource) [0x00000] in <filename unknown>:0 
		  at System.Collections.Generic.Dictionary`2[IKVM.Reflection.TypeName,IKVM.Reflection.Type].Insert (TypeName key, IKVM.Reflection.Type value, Boolean add) [0x00000] in <filename unknown>:0 
		  at System.Collections.Generic.Dictionary`2[IKVM.Reflection.TypeName,IKVM.Reflection.Type].Add (TypeName key, IKVM.Reflection.Type value) [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Reader.ModuleReader.PopulateTypeDef () [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Reader.ModuleReader.FindType (TypeName typeName) [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Reader.AssemblyReader.FindType (TypeName typeName) [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Assembly.GetType (System.String name, Boolean throwOnError, Boolean ignoreCase) [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Assembly.GetType (System.String name, Boolean throwOnError) [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Assembly.GetType (System.String name) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.StaticLoader.HasObjectType (IKVM.Reflection.Assembly assembly) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.AssemblyReferencesLoader`1[IKVM.Reflection.Assembly].LoadReferencesCore (Mono.CSharp.ModuleContainer module, IKVM.Reflection.Assembly& corlib_assembly, System.Collections.Generic.List`1& loaded) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.StaticLoader.LoadReferences (Mono.CSharp.ModuleContainer module) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 
/usr/lib/mono/4.5/Microsoft.CSharp.targets: error : Compiler crashed with code: 1.
	Task "Csc" execution -- FAILED
....

Mono version 4.0.1 from the xamarin packages. I suspect that some transitive dependency is missing; nonetheless the compiler should not crash in this way, but print the name of the missing dependency.

Invoking the mcs command on the command line gives the same error, it is not specific to xbuild.

I have not been successful in getting a better compiler output yet since xbuild neither honours the MONO_OPTS environment variable nor does running the compiler with "mono --debug /usr/lib/mono/4.5/mcs.exe ..." give more information in the stacktrace (mono-dbg and mono-runtime-dbg are installed).
Comment 1 blinke76 2015-06-08 10:13:57 UTC
Update:

After downgrading to Mono 3.2.8 the compiler still crashes, but the error message is a little bit more helpful:

		Unhandled Exception:
		Mono.CSharp.InternalErrorException: Failed to import assembly `Conveyor.Alignment.Application.Prank, Version=1.0.5632.28291, Culture=neutral, PublicKeyToken=null' ---> System.ArgumentException: An element with the same key already exists in the dictionary.
		  at System.Collections.Generic.Dictionary`2[IKVM.Reflection.TypeName,IKVM.Reflection.Type].Add (TypeName key, IKVM.Reflection.Type value) [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Reader.ModuleReader.PopulateTypeDef () [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Reader.ModuleReader.GetTypesImpl (System.Collections.Generic.List`1 list) [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Module.GetTypes () [0x00000] in <filename unknown>:0 
		  at IKVM.Reflection.Reader.AssemblyReader.GetTypes () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.StaticImporter.ImportAssembly (IKVM.Reflection.Assembly assembly, Mono.CSharp.RootNamespace targetNamespace) [0x00000] in <filename unknown>:0 
		  --- End of inner exception stack trace ---
		  at Mono.CSharp.StaticImporter.ImportAssembly (IKVM.Reflection.Assembly assembly, Mono.CSharp.RootNamespace targetNamespace) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.StaticLoader.LoadReferences (Mono.CSharp.ModuleContainer module) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 

The mentioned Conveyor.Alignment.Application.Prank projects itself compiles without a problem. But I haven't tried to use it inside the application yet.
Comment 2 Marek Safar 2015-06-17 11:32:47 UTC
Where can get I this Conveyor.Alignment.Application.Prank assembly? Preferably both binary and source code version
Comment 3 blinke76 2015-06-29 08:35:20 UTC
Created attachment 11763 [details]
Conveyor.Alignment.Application.Prank assembly source code
Comment 4 blinke76 2015-06-29 08:36:02 UTC
Created attachment 11764 [details]
Source code + compiled results incl. all dependencies for the failing unit test library
Comment 5 Marek Safar 2015-06-30 05:51:44 UTC
Fixed in master and Mono 4.2