[Mono-bugs] [Bug 480819] New: delegate ParameterType returns unexpected type

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Mar 1 17:43:31 EST 2009


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


           Summary: delegate ParameterType returns unexpected type
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: generics
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: basjsmit at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6)
Gecko/2009011913 Firefox/3.0.6

using System;

class Program
{
    private static void Main()
    {
        var target = new Foo<string>();

        var action = Activator.CreateInstance(
                                  
typeof(Action<>).MakeGenericType(typeof(string)),
                                   target,
                                  
target.GetType().GetMethod("Bar").MethodHandle.GetFunctionPointer()) as
Action<string>;


        if (action.Method.GetParameters()[0].ParameterType == typeof(string))
            Console.WriteLine("clr");
        if (action.Method.GetParameters()[0].ParameterType == typeof(object))
            Console.WriteLine("mono");
    }
}

class Foo<T>
{
    public void Bar(T value) { }
}


Reproducible: Always

Steps to Reproduce:
1.Compile and run code above

Actual Results:  
differs from clr


Expected Results:  
identical to clr


built with csc, tested on r128214 Fri Feb 27 15:57:55 CET 2009

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