[Mono-bugs] [Bug 354757] IsGenericMethodDefinition returns false for open generic method

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jan 23 21:03:33 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=354757

User rkumpera at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=354757#c9





--- Comment #9 from Rodrigo Kumpera <rkumpera at novell.com>  2008-01-23 19:03:32 MST ---
I implemented a hack similar to is_tb_open. It is the way to fix the issue
under the current setup of SRE.

The patch fixes gtest-261, but gtest-045 still breaking. Some constraints
expected by gmcs might have been broken by the patch, still need to investigate
that.

The patch makes the following code print True False, which is the expected
result:


using System;
using System.Reflection;
using System.Reflection.Emit;

public class Entry
{
    public static void Main()
    {
        AssemblyName name = new AssemblyName("I");
        AssemblyBuilder asmbuild =
System.Threading.Thread.GetDomain().DefineDynamicAssembly(name,
AssemblyBuilderAccess.RunAndSave);
        ModuleBuilder mod = asmbuild.DefineDynamicModule("I.exe");

        TypeBuilder G = mod.DefineType("G", TypeAttributes.Public);
        Type T = G.DefineGenericParameters("T")[0];
        Type GObj = G.MakeGenericType (new Type[] { typeof(object) });

        MethodBuilder M = G.DefineMethod("M", MethodAttributes.Public);
        Type S = M.DefineGenericParameters("S")[0];

        MethodInfo GObjM = TypeBuilder.GetMethod(GObj, M);
        Console.WriteLine (GObjM.IsGenericMethodDefinition);

                GObjM = GObjM.MakeGenericMethod (S);
                Console.WriteLine (GObjM.IsGenericMethodDefinition);
    }
}


-- 
Configure bugmail: https://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