[Mono-bugs] [Bug 613855] New: cannot retrieve type-instanciated methods from type created with MakeGenericType

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jun 13 14:29:54 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=613855

http://bugzilla.novell.com/show_bug.cgi?id=613855#c0


           Summary: cannot retrieve type-instanciated methods from type
                    created with MakeGenericType
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: diakopter at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; WOW64; en-US;
rv:1.9.3a6pre) Gecko/20100611 Minefield/3.7a6pre

using System;
using System.Collections.Generic;
using System.Reflection.Emit;

namespace Test0001
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            var list_type = typeof(List<>);
            var list_of_int =
list_type.UnderlyingSystemType.MakeGenericType(typeof(int)); // This is a
MonoType
            foreach (var method in list_of_int.GetMethods()) { // These are
MonoMethod
                // I need the type-instanciated edition of each method, but
these are the generic ones
                Console.WriteLine (method);

                //  Unhandled Exception: System.ArgumentException: type is not
TypeBuilder but System.MonoType
                //  Parameter name: type
                //  at System.Reflection.Emit.TypeBuilder.GetMethod
(System.Type type, System.Reflection.MethodInfo method) [0x000a9] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.6.4\mcs\class\corlib\System.Reflection.Emit\TypeBuilder.cs:1899 
                //  at Test0001.MainClass.Main (System.String[] args) [0x00044]
in C:\Projects\Test0001\Test0001\Main.cs:18 
                // Console.WriteLine (TypeBuilder.GetMethod(list_of_int,
method).ToString());
            }
        }
    }
}





Reproducible: Always

Steps to Reproduce:
1. build the above, run it.  
2. uncomment the last line, build/run.
3.  Uncaught exception.
Actual Results:  
Unhandled Exception: System.ArgumentException: type is not TypeBuilder but
System.MonoType
Parameter name: type
at System.Reflection.Emit.TypeBuilder.GetMethod (System.Type type,
System.Reflection.MethodInfo method) [0x000a9] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.6.4\mcs\class\corlib\System.Reflection.Emit\TypeBuilder.cs:1899 
at Test0001.MainClass.Main (System.String[] args) [0x00044] in
C:\Projects\Test0001\Test0001\Main.cs:18


MS returns a TypeBuilderInstantiation from MakeGenericType, but mono returns a
MonoType.  

Expected Results:  
The results that MS shows - no exception thrown and the type-instantiated
methods on the type-instantiated generic type are returned.

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


More information about the mono-bugs mailing list