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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
