[Mono-bugs] [Bug 58846][Wis] New - InvokeMember with args={null} fails

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 22 May 2004 04:47:55 -0400 (EDT)

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 timsuth@ihug.co.nz.


--- shadow/58846	2004-05-22 04:47:55.000000000 -0400
+++ shadow/58846.tmp.9677	2004-05-22 04:47:55.000000000 -0400
@@ -0,0 +1,66 @@
+Bug#: 58846
+Product: Mono: Class Libraries
+Version: unspecified
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: timsuth@ihug.co.nz               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: InvokeMember with args={null} fails
+System.Type#InvokeMember gives a NullReferenceException when called with
+arguments like
+    type.InvokeMember(
+        "SampleMethod",
+        B.Public | B.Static | B.InvokeMethod,
+        null,
+        null,
+        new object[] { null } // this causes the problem
+    );
+I'll attach a program in a moment that demonstrates the problem. When run,
+it gives the following output:
+Invoking with argument 'foo'
+Finished invocation
+Invoking with argument ''
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in (unmanaged) (wrapper managed-to-native) System.Type:GetTypeCode
+in <0x00004> (wrapper managed-to-native) System.Type:GetTypeCode (System.Type)
+in <0x0006d> Default:check_type (System.Type,System.Type)
+in <0x00052> Default:check_arguments
+                             nfo[])
+in <0x0017c> Default:SelectMethod
+in <0x000b5> Default:BindToMethod
+in <0x00483> System.MonoType:InvokeMember
+in <0x0002a> System.Type:InvokeMember
+                            tem.Reflection.Binder,object,object[])
+in <0x0006b> InvokeNull:invoke (System.Type,object)
+in <0x0007b> InvokeNull:Main (string[])