BUG? ldtoken with generic methoddef throws an MissingMethodException exception

Unanswered BUG? ldtoken with generic methoddef throws an MissingMethodException exception

  • Wednesday, April 05, 2006 8:26 PM
     
     
    Hello,

    I have some question or problem related to the ldtoken ILDASM instruction followed by a methoddef, when the methoddef is a generic method.

    For instance (method body skipped):

    .class private auto ansi PostSharp.Laos.Test.Program
          extends [mscorlib]System.Object
     {
    .method private hidebysig static void TestGenericMethod<T>(!!T arg) cil managed
    }


    and later in the code:

    ldtoken    method void PostSharp.Laos.Test.Program::TestGenericMethod(!!0)


    PEVERIFY gives:

    [IL]: Error: [PostSharp.Laos.Test_post.exe : $PostSharp_Laos_Implementation$::.cctor][offset 0x00000051][token  0x0A000023]System.MissingMethodException: Method not found: 'Void PostSharp.Laos.Test.Program.TestGenericMethod(!!0)'. Method is not visible.
    1 Error Verifying PostSharp.Laos.Test_post.exe

    The runtime gives something similar.

    Am I doing something wrong or is it a bug of MSCOR?

    Thank you.

    Gael Fraiteur