[Mono-bugs] [Bug 587106] New: TypeBuilder.GetMethod throws unexpectedly

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Mar 10 11:36:30 EST 2010



           Summary: TypeBuilder.GetMethod throws unexpectedly
    Classification: Mono
           Product: Mono: Runtime
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: generics
        AssignedTo: rkumpera at novell.com
        ReportedBy: msafar at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

compile & run

using System;

using System.Threading;

using System.Reflection;

using System.Reflection.Emit;

class C


    public static void Main ()


        TypeBuilder tb;

        ILGenerator il_gen;

        AssemblyName assemblyName = new AssemblyName ();

        assemblyName.Name = "MonoTests.System.Reflection.Emit.ILGeneratorTest";

        AssemblyBuilder assembly = Thread.GetDomain ().DefineDynamicAssembly (

            assemblyName, AssemblyBuilderAccess.RunAndSave);

        ModuleBuilder module =

        tb = module.DefineType ("T", TypeAttributes.Public);


        MethodBuilder mb = tb.DefineMethod("F",

            MethodAttributes.Public, typeof(string), null);

        il_gen = mb.GetILGenerator ();

        il_gen.Emit (OpCodes.Ret);

        TypeBuilder.GetMethod (tb, mb);



Unhandled Exception: System.InvalidOperationException: can only be called in
generic type
  at System.Type.GetMethod (System.Reflection.MethodInfo fromNoninstanciated)
[0x00000] in <filename unknown>:0 
  at System.Reflection.Emit.TypeBuilder.GetMethod (System.Type type,
System.Reflection.MethodInfo method) [0x00000] in <filename unknown>:0 
  at C.Main () [0x00000] in <filename unknown>:0

Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list