[Mono-bugs] [Bug 29807][Wis] New - Delegate.CreateDelegate(Type,Type,string) does not work

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
3 Sep 2002 14:42:00 -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=29807

--- shadow/29807	Tue Sep  3 10:42:00 2002
+++ shadow/29807.tmp.22545	Tue Sep  3 10:42:00 2002
@@ -0,0 +1,48 @@
+Bug#: 29807
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ric@users.sourceforge.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Delegate.CreateDelegate(Type,Type,string) does not work
+
+The following code should create a delegate for the static methos
+Sting.Equals(string,string). Instead, it throws a NullReferenceException in 
+System.Delegate:CreateDelegate_internal
+
+namespace T1 {
+  using System;
+  public class T {
+    delegate bool Comparator (string s1, string s2);
+    public static void Main (string[] args)
+    {
+      Type dt = typeof (Comparator);
+      Type ct = typeof (String);
+      Console.WriteLine ("{0} {1}", dt, ct);
+      Delegate d = Delegate.CreateDelegate (dt, ct, "Equals");
+      Console.WriteLine ("{0}", d);
+      }
+    }
+}
+
+results in:
+T1.T+Comparator System.String
+
+Unhandled Exception: System.NullReferenceException: A null value was found
+where an object instance was required
+in (unmanaged) 06 System.Delegate:CreateDelegate_internal
+(System.Type,object,System.Reflection.MethodInfo)
+in <0x00004> 06 System.Delegate:CreateDelegate_internal
+(System.Type,object,System.Reflection.MethodInfo)
+in <0x00125> 00 System.Delegate:CreateDelegate (System.Type,System.Type,string)
+in <0x0007c> 00 T1.T:Main (string[])