[Mono-bugs] [Bug 71396][Blo] New - MethodInfo.Invoke fails for ref parameters

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 18 Jan 2005 09:22:38 -0500 (EST)


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 lluis@ximian.com.

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

--- shadow/71396	2005-01-18 09:22:38.000000000 -0500
+++ shadow/71396.tmp.20675	2005-01-18 09:22:38.000000000 -0500
@@ -0,0 +1,47 @@
+Bug#: 71396
+Product: Mono: Class Libraries
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lluis@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: MethodInfo.Invoke fails for ref parameters
+
+MethodInfo.Invoke throws an exception when invoked for a method that has by
+ref parameters. This fails in the 1.0 branch but it works in HEAD. A test case:
+
+using System;
+using System.Reflection;
+
+public class Test
+{
+	public static void Main()
+	{
+		Test t = new Test ();
+		object[] pars = new object[] {"hi" };
+		typeof(Test).GetMethod ("Run").Invoke (t, pars);
+		Console.WriteLine (pars[0]);
+	}
+	
+	public void Run (ref string b)
+	{
+		b += " bye";
+	}
+}
+
+I get this:
+
+Unhandled Exception: System.ArgumentException: parameters
+in <0x00085> System.Reflection.MonoMethod:Invoke
+(object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
+in <0x00021> System.Reflection.MethodBase:Invoke (object,object[])
+in <0x00081> Test:Main ()