[Mono-bugs] [Bug 76484][Nor] New - [GMCS] assertion failed: (ex_info->handlers)

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Oct 19 17:37:26 EDT 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 malekith at pld-linux.org.

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

--- shadow/76484	2005-10-19 17:37:26.000000000 -0400
+++ shadow/76484.tmp.3882	2005-10-19 17:37:26.000000000 -0400
@@ -0,0 +1,80 @@
+Bug#: 76484
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: amd64 pld linux
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: malekith at pld-linux.org               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] assertion failed: (ex_info->handlers)
+
+Description of Problem:
+
+When we try to use TypeBuilder.GetMethod, when an exception block is being
+generated, the assertion fires.
+
+#v+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+class M {
+         static void Main () {
+            /// INITIAL ASSEMBLY CREATION
+            AssemblyName name = new AssemblyName();
+            name.Name = "o";
+            AssemblyBuilder builder =
+AppDomain.CurrentDomain.DefineDynamicAssembly(name,
+AssemblyBuilderAccess.RunAndSave);
+            ModuleBuilder mb = builder.DefineDynamicModule("out", "bla.dll");
+            ///////////
+
+            TypeBuilder func = mb.DefineType("Foo", TypeAttributes.Public);
+            GenericTypeParameterBuilder[] func_gp =
+func.DefineGenericParameters("A");
+            func.SetParent(typeof(object));
+
+            MethodBuilder func_apply = func.DefineMethod("bar",
+MethodAttributes.Public,
+                 typeof(object), new Type[] { });
+
+            ILGenerator il = func_apply.GetILGenerator();
+
+                        il.BeginExceptionBlock ();
+
+                        // exception here!
+                        MethodInfo mi = TypeBuilder.GetMethod
+(func.GetGenericTypeDefinition ().MakeGenericType (new Type [] { func_gp[0]
+}), func_apply);
+
+                        il.BeginFinallyBlock ();
+                        il.EndExceptionBlock ();
+
+            il.Emit (OpCodes.Ldnull);
+            il.Emit (OpCodes.Ret);
+
+            func.CreateType();
+
+            builder.Save("bla.dll");
+         }
+}
+#v-
+
+when run, it gives:
+
+** ERROR **: file reflection.c: line 838 (method_encode_clauses): assertion
+failed: (ex_info->handlers)
+aborting...
+
+The workaround is to additionally run this GetMethod before the
+BeginExceptionBlock, so the type is initialized.
+
+Works fine on ms.net aug ctp.


More information about the mono-bugs mailing list