Bug 16659 - Compiler crashes with a null reference exception
Summary: Compiler crashes with a null reference exception
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 3.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2013-12-08 00:15 UTC by Scott S.
Modified: 2013-12-10 05:16 UTC (History)
2 users (show)

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

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 Scott S. 2013-12-08 00:15:57 UTC
Attempting to compile an existing project with mono crashes the compiler with a null reference exception.  See below for a stack trace.  The project is known to compile and run with Visual Studio.

I have attempted to create a minimal test case to expose the issue with no luck so far.  I have setup a branch on github from which the issue can be easily reproduced.  The branch has the same error as the master branch, but a few other windows related problems have been removed to make the error in question easier to find.

To repro this issue:
Check out the mono-crash branch from https://github.com/sschlesier/NzbDrone.git
Load the ./src/NzbDrone.sln in Xamarin Studio
Project | Restore Nuget packages
Build

This will result in "Compiler crashsd with code: 1."

and a stack trace similar to 

Unhandled Exception:
		Mono.CSharp.InternalErrorException: REST/RestModule.cs(214,43): NzbDrone.Api.REST.RestModule<TResource>.ReadPagingResourceFromRequest() ---> Mono.CSharp.InternalErrorException: REST/RestModule.cs(215,9): ---> System.NullReferenceException: Object reference not set to an instance of an object
		  at Mono.CSharp.TypeSpecComparer+DefaultImpl.System.Collections.Generic.IEqualityComparer<Mono.CSharp.TypeSpec[]>.GetHashCode (Mono.CSharp.TypeSpec[] obj) [0x00000] in <filename unknown>:0 
		  at System.Collections.Generic.Dictionary`2[Mono.CSharp.TypeSpec[],Mono.CSharp.InflatedTypeSpec].TryGetValue (Mono.CSharp.TypeSpec[] key, Mono.CSharp.InflatedTypeSpec& value) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeSpec.MakeGenericType (IModuleContext context, Mono.CSharp.TypeSpec[] targs) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeParameterInflator.Inflate (Mono.CSharp.TypeSpec type) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.FieldSpec.InflateMember (TypeParameterInflator inflator) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.DynamicExpressionStatement.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression binder, Mono.CSharp.Arguments arguments, Boolean isStatement) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.DynamicExpressionStatement.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.DynamicInvocation.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.StatementExpression.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.ParametersBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  --- End of inner exception stack trace ---
		  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.MethodData.Emit (Mono.CSharp.TypeDefinition parent) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.MethodOrOperator.Emit () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Method.Emit () [0x00000] in <filename unknown>:0 
		  --- End of inner exception stack trace ---
		  at Mono.CSharp.Method.Emit () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeDefinition.Emit () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.ClassOrStruct.Emit () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Class.Emit () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeDefinition.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.ModuleContainer.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.AssemblyDefinitionStatic.Emit () [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: Mono.CSharp.InternalErrorException: REST/RestModule.cs(214,43): NzbDrone.Api.REST.RestModule<TResource>.ReadPagingResourceFromRequest() ---> Mono.CSharp.InternalErrorException: REST/RestModule.cs(215,9): ---> System.NullReferenceException: Object reference not set to an instance of an object
		  at Mono.CSharp.TypeSpecComparer+DefaultImpl.System.Collections.Generic.IEqualityComparer<Mono.CSharp.TypeSpec[]>.GetHashCode (Mono.CSharp.TypeSpec[] obj) [0x00000] in <filename unknown>:0 
		  at System.Collections.Generic.Dictionary`2[Mono.CSharp.TypeSpec[],Mono.CSharp.InflatedTypeSpec].TryGetValue (Mono.CSharp.TypeSpec[] key, Mono.CSharp.InflatedTypeSpec& value) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeSpec.MakeGenericType (IModuleContext context, Mono.CSharp.TypeSpec[] targs) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeParameterInflator.Inflate (Mono.CSharp.TypeSpec type) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.FieldSpec.InflateMember (TypeParameterInflator inflator) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.DynamicExpressionStatement.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression binder, Mono.CSharp.Arguments arguments, Boolean isStatement) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.DynamicExpressionStatement.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.DynamicInvocation.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.StatementExpression.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.ParametersBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  --- End of inner exception stack trace ---
		  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.MethodData.Emit (Mono.CSharp.TypeDefinition parent) [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.MethodOrOperator.Emit () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Method.Emit () [0x00000] in <filename unknown>:0 
		  --- End of inner exception stack trace ---
		  at Mono.CSharp.Method.Emit () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeDefinition.Emit () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.ClassOrStruct.Emit () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.Class.Emit () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeDefinition.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.ModuleContainer.EmitContainer () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0 
		  at Mono.CSharp.AssemblyDefinitionStatic.Emit () [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 
/Library/Frameworks/Mono.framework/Versions/3.2.5/lib/mono/4.0/Microsoft.CSharp.targets: error : Compiler crashed with code: 1.
Comment 1 Marek Safar 2013-12-10 05:16:04 UTC
Fixed in master