[Mono-bugs] [Bug 76642][Nor] New - mcs crashes on resolving exceptions to anonymous methods

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Nov 7 13:45:43 EST 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by abockover at novell.com.

http://bugzilla.ximian.com/show_bug.cgi?id=76642

--- shadow/76642	2005-11-07 13:45:43.000000000 -0500
+++ shadow/76642.tmp.24091	2005-11-07 13:45:43.000000000 -0500
@@ -0,0 +1,55 @@
+Bug#: 76642
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: SUSE 10.0
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: abockover at novell.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs crashes on resolving exceptions to anonymous methods
+
+Last night in Banshee I encountered a bug in mcs (HEAD and 1.1.9.2) wherein
+mcs would crash when it was to resolve an exception to an anonymous method
+in a catch() {} block:
+
+try {
+  throw new Exception("exception");
+} catch(Exception e) {
+  Call(delegate { Console.WriteLine(e.Message); });
+}
+
+The crash from mcs yields the following output:
+
+aaron at linux:~/Desktop$ mcs ExceptionResolutionToAnonMethod.cs
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x000a5> System.Reflection.Emit.ILGenerator:Emit (OpCode opcode,
+System.Reflection.Emit.LocalBuilder lbuilder)
+in <0x00120> Mono.CSharp.Try:DoEmit (Mono.CSharp.EmitContext ec)
+in <0x00024> Mono.CSharp.Statement:Emit (Mono.CSharp.EmitContext ec)
+in <0x000a8> Mono.CSharp.Block:DoEmit (Mono.CSharp.EmitContext ec)
+in <0x00254> Mono.CSharp.Block:Emit (Mono.CSharp.EmitContext ec)
+in <0x0001b> Mono.CSharp.EmitContext:EmitResolvedTopBlock
+(Mono.CSharp.ToplevelBlock block, Boolean unreachable)
+in <0x00068> Mono.CSharp.EmitContext:EmitTopBlock (IMethodData md,
+Mono.CSharp.ToplevelBlock block, Mono.CSharp.InternalParameters ip)
+in <0x001f2> Mono.CSharp.MethodData:Emit (Mono.CSharp.TypeContainer
+container, Mono.CSharp.Attributable kind)
+in <0x00029> Mono.CSharp.Method:Emit ()
+in <0x0064d> Mono.CSharp.TypeContainer:EmitType ()
+in <0x00225> Mono.CSharp.RootContext:EmitCode ()
+in <0x00c63> Mono.CSharp.Driver:MainDriver (System.String[] args)
+in <0x0000f> Mono.CSharp.Driver:Main (System.String[] args)
+
+I will attach a full test case, with a small work around, where I assign
+the e Exception to a temporary local variable, which is then resolved
+properly to the anonymous method.


More information about the mono-bugs mailing list