[Mono-bugs] [Bug 333647] New: Delegate.CreateDelegate doesn't accept instance method
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sat Oct 13 06:47:59 EDT 2007
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: mono-bugs at ximian.com
ReportedBy: sanxiyn at gmail.com
QAContact: mono-bugs at ximian.com
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.
More information about the mono-bugs
mailing list