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

           Summary: Delegate.CreateDelegate doesn't accept instance method
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [EMAIL PROTECTED]
          Found By: ---


Testcase:

using System;
using System.Reflection;

public class C {
    public void M() {}
}

public delegate void D(C c);

public class test {
    public static void Main() {
        C c = new C();
        MethodInfo m = typeof(C).GetMethod("M");
        D d = (D)Delegate.CreateDelegate(typeof(D), m);
        d(c);
    }
}

Actual Result:

Unhandled Exception: System.ArgumentException: The method should be static.

Expected Result:

This succeeds on .NET 2.0.

MSDN says (http://msdn2.microsoft.com/en-us/library/53cz7sc6(vs.80).aspx):

Delegate.CreateDelegate Method (Type, MethodInfo)
Parameters
method
The MethodInfo describing the static or instance method the delegate is to
represent. Only static methods are supported in the .NET Framework version 1.0
and 1.1.

Implicit is that instance methods are supported in .NET 2.0.


-- 
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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to