[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.

http://bugzilla.ximian.com/show_bug.cgi?id=58846

--- 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: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: timsuth@ihug.co.nz               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+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
+(System.Type)
+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
+(System.Type[],System.Reflection.ParameterI                               
+                             nfo[])
+in <0x0017c> Default:SelectMethod
+(System.Reflection.BindingFlags,System.Reflect                            
+                               
+ion.MethodBase[],System.Type[],System.Reflection.ParameterModifier[])
+in <0x000b5> Default:BindToMethod
+(System.Reflection.BindingFlags,System.Reflect                            
+                               
+ion.MethodBase[],object[]&,System.Reflection.ParameterModifier[],System.Globaliz
+                                                           
+ation.CultureInfo,string[],object&)
+in <0x00483> System.MonoType:InvokeMember
+(string,System.Reflection.BindingFlags                                    
+                       
+,System.Reflection.Binder,object,object[],System.Reflection.ParameterModifier[],
+                                                           
+System.Globalization.CultureInfo,string[])
+in <0x0002a> System.Type:InvokeMember
+(string,System.Reflection.BindingFlags,Sys                                
+                            tem.Reflection.Binder,object,object[])
+in <0x0006b> InvokeNull:invoke (System.Type,object)
+in <0x0007b> InvokeNull:Main (string[])