Bug 319335 (MONO76484) - [GMCS] assertion failed: (ex_info->handlers)
Summary: [GMCS] assertion failed: (ex_info->handlers)
Status: RESOLVED FIXED
Alias: MONO76484
Product: Mono: Runtime
Classification: Mono
Component: misc (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-20 00:37 UTC by Michal Moskal
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:35:26 UTC


---- Reported by malekith@pld-linux.org 2005-10-19 17:37:26 MST ----

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.



---- Additional Comments From martin@ximian.com 2006-06-21 10:17:08 MST ----

Fixed in SVN.


Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>amd64 pld linux</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".