[Mono-bugs] [Bug 29871][Nor] New - Delegete.CreateDelegate(Type,object,string) returns delegates for static methods
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
4 Sep 2002 15:19:36 -0000
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by ric@users.sourceforge.net.
http://bugzilla.ximian.com/show_bug.cgi?id=29871
--- shadow/29871 Wed Sep 4 11:19:36 2002
+++ shadow/29871.tmp.2975 Wed Sep 4 11:19:36 2002
@@ -0,0 +1,52 @@
+Bug#: 29871
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: ric@users.sourceforge.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Delegete.CreateDelegate(Type,object,string) returns delegates for static methods
+
+Delegete.CreateDelegate(Type,object,string) returns delegates for static
+methods, but the docs say that it should only consider instance methods
+(see
+http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDelegateClassCreateDelegateTopic2.asp?frame=true).
+
+The following program shows the error:
+
+namespace T1 {
+ using System;
+
+ public class T {
+
+ delegate bool Comparator (string s1, string s2);
+
+ public static void Main (string[] args)
+ {
+ Type dt = typeof (Comparator);
+ A a = new A ();
+ Console.WriteLine ("{0} {1}", dt, a);
+ Delegate d = Delegate.CreateDelegate (dt, a, "M1");
+ Console.WriteLine ("{0}", d);
+ }
+
+ }
+
+ public class A {
+ static bool M1 (string s1, string s2)
+ {
+ return s1 == s2;
+ }
+ }
+}
+
+This program creates a delegate for M1, but it shouldn't.