[Mono-bugs] [Bug 79092][Wis] New - type.InvokeMethod fails when using out parameters

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Aug 17 06:23:46 EDT 2006


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 ccirstea at saguaronet.ro.

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

--- shadow/79092	2006-08-17 06:23:46.000000000 -0400
+++ shadow/79092.tmp.26116	2006-08-17 06:23:46.000000000 -0400
@@ -0,0 +1,104 @@
+Bug#: 79092
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: Fedora 4
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: ccirstea at saguaronet.ro               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Summary: type.InvokeMethod fails when using out parameters
+
+Please fill in this template when reporting a bug, unless you know what you 
+are doing.
+Description of Problem:
+
+It seems that InvokeMethod fails when invoking a method that has "out"/
+"ref" parameters.
+
+Steps to reproduce the problem:
+1. Run the following code:
+
+using System;
+using System.Reflection;
+
+namespace Invoke
+{
+
+
+ 	public class Invoke
+	 {
+		 public static void Main(string [] cmdargs)
+		 {
+			 Type t = typeof(TypeClass);
+
+			TypeClass instance =new TypeClass();
+			
+			int h = 10;
+			
+			int w = 20;
+			 object[] argValues = new object [] {h,w};
+
+		
+			 t.InvokeMember("PrintName",
+				 BindingFlags.InvokeMethod | BindingFlags.Public,
+				 null,
+				 instance,
+				 argValues);
+				 
+			System.Console.WriteLine(h);	 
+		 }
+	 }
+
+	 public class TypeClass
+	 {
+	 	
+		public void PrintName (out int lastName,out int firstName)
+		{
+			 firstName = 1;
+			 lastName =2;
+			// Console.WriteLine(firstName);
+			// Console.WriteLine(lastName);
+	 	}
+	 }
+}
+
+
+2. 
+3. 
+
+Actual Results:
+
+Unhandled Exception: System.MissingMethodException: The best match for 
+method PrintName has some invalid parameter.
+  at System.MonoType.InvokeMember (System.String name, BindingFlags 
+invokeAttr, System.Reflection.Binder binder, System.Object target, System.
+Object[] args, System.Reflection.ParameterModifier[] modifiers, System.
+Globalization.CultureInfo culture, System.String[] namedParameters) 
+[0x004e3] in /tmp/scratch/BUILD/mono-1.1.16.1/mcs/class/corlib/System/
+MonoType.cs:453 
+  at System.Type.InvokeMember (System.String name, BindingFlags invokeAttr, 
+System.Reflection.Binder binder, System.Object target, System.Object[] 
+args) [0x00000] in /tmp/scratch/BUILD/mono-1.1.16.1/mcs/class/corlib/
+System/Type.cs:1066 
+  at Invoke.Invoke.Main (System.String[] cmdargs) [0x00031] in /
+programming/mono/tests/Invoke/Invoke/Invoke/Main.cs:23 
+
+
+
+Expected Results:
+
+Change the values for h and w
+
+How often does this happen? 
+Always
+
+Additional Information:
+
+Using Mono 1.1.16.1, both mcs and gmcs compilers


More information about the mono-bugs mailing list