Bug 54159 - Compiler crashes when calling method named Finalize
Summary: Compiler crashes when calling method named Finalize
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 4.8.0 (C9)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2017-03-29 01:26 UTC by Jonathan Chambers
Modified: 2017-05-28 11:53 UTC (History)
1 user (show)

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


Attachments
Test Case Files (673 bytes, application/zip)
2017-03-29 01:26 UTC, Jonathan Chambers
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 Jonathan Chambers 2017-03-29 01:26:59 UTC
Created attachment 20972 [details]
Test Case Files

Repro

mcs a.cs -t:library
mcs b.cs -t:library -r:a.dll

Output:

Mono.CSharp.InternalErrorException: b.cs(6,14): Class2.NotWritingAnything() ---> Mono.CSharp.InternalErrorException: b.cs(6,34): ---> System.NullReferenceException: Object reference not set to an instance of an object
  at Mono.CSharp.MemberExpr.EmitInstance (Mono.CSharp.EmitContext ec, System.Boolean prepare_for_load) [0x00000] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.FieldExpr.Emit (Mono.CSharp.EmitContext ec, System.Boolean leave_copy) [0x0007e] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.FieldExpr.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.InstanceEmitter.EmitLoad (Mono.CSharp.EmitContext ec, System.Boolean boxInstance) [0x00059] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.InstanceEmitter.Emit (Mono.CSharp.EmitContext ec, System.Boolean conditionalAccess) [0x000db] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.CallEmitter.EmitPredefined (Mono.CSharp.EmitContext ec, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, System.Boolean statement, System.Nullable`1[T] loc) [0x000ef] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.CallEmitter.Emit (Mono.CSharp.EmitContext ec, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Mono.CSharp.Location loc) [0x0000c] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Arguments arguments, System.Boolean statement) [0x00042] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x0003a] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.VariableReference.EmitAssign (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression source, System.Boolean leave_copy, System.Boolean prepare_for_load) [0x0007c] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec, System.Boolean is_statement) [0x0000c] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Assign.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.BlockVariable.DoEmit (Mono.CSharp.EmitContext ec) [0x00028] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x0000d] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00013] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x0004e] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.ParametersBlock.Emit (Mono.CSharp.EmitContext ec) [0x00036] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00045] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
   --- End of inner exception stack trace ---
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x000df] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.MethodData.Emit (Mono.CSharp.TypeDefinition parent) [0x00092] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.MethodOrOperator.Emit () [0x001d0] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Method.Emit () [0x0012c] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
   --- End of inner exception stack trace ---
  at Mono.CSharp.Method.Emit () [0x00141] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.TypeDefinition.Emit () [0x0026e] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.ClassOrStruct.Emit () [0x00025] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Class.Emit () [0x00000] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.TypeDefinition.EmitContainer () [0x0000f] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00007] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.ModuleContainer.EmitContainer () [0x0009c] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.AssemblyDefinition.Emit () [0x00098] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.AssemblyDefinitionStatic.Emit () [0x00126] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Driver.Compile () [0x002f3] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00052] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: Mono.CSharp.InternalErrorException: b.cs(6,14): Class2.NotWritingAnything() ---> Mono.CSharp.InternalErrorException: b.cs(6,34): ---> System.NullReferenceException: Object reference not set to an instance of an object
  at Mono.CSharp.MemberExpr.EmitInstance (Mono.CSharp.EmitContext ec, System.Boolean prepare_for_load) [0x00000] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.FieldExpr.Emit (Mono.CSharp.EmitContext ec, System.Boolean leave_copy) [0x0007e] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.FieldExpr.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.InstanceEmitter.EmitLoad (Mono.CSharp.EmitContext ec, System.Boolean boxInstance) [0x00059] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.InstanceEmitter.Emit (Mono.CSharp.EmitContext ec, System.Boolean conditionalAccess) [0x000db] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.CallEmitter.EmitPredefined (Mono.CSharp.EmitContext ec, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, System.Boolean statement, System.Nullable`1[T] loc) [0x000ef] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.CallEmitter.Emit (Mono.CSharp.EmitContext ec, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Mono.CSharp.Location loc) [0x0000c] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Arguments arguments, System.Boolean statement) [0x00042] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x0003a] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.VariableReference.EmitAssign (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression source, System.Boolean leave_copy, System.Boolean prepare_for_load) [0x0007c] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec, System.Boolean is_statement) [0x0000c] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Assign.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.BlockVariable.DoEmit (Mono.CSharp.EmitContext ec) [0x00028] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x0000d] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00013] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x0004e] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.ParametersBlock.Emit (Mono.CSharp.EmitContext ec) [0x00036] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00045] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
   --- End of inner exception stack trace ---
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x000df] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.MethodData.Emit (Mono.CSharp.TypeDefinition parent) [0x00092] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.MethodOrOperator.Emit () [0x001d0] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Method.Emit () [0x0012c] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
   --- End of inner exception stack trace ---
  at Mono.CSharp.Method.Emit () [0x00141] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.TypeDefinition.Emit () [0x0026e] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.ClassOrStruct.Emit () [0x00025] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Class.Emit () [0x00000] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.TypeDefinition.EmitContainer () [0x0000f] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00007] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.ModuleContainer.EmitContainer () [0x0009c] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.AssemblyDefinition.Emit () [0x00098] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.AssemblyDefinitionStatic.Emit () [0x00126] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Driver.Compile () [0x002f3] in <6bbc6c0cb72c483591ecb52f650927cf>:0 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00052] in <6bbc6c0cb72c483591ecb52f650927cf>:0
Comment 1 Marek Safar 2017-05-28 11:53:38 UTC
Fixed in master