[Mono-list] Bug in System.Type.InvokeMember!!

Jonathan Pryor jonpryor@vt.edu
21 Apr 2003 10:12:05 -0400


Actually, that looks like a bug in .NET, not mono. :-)

You're passing firstName=Hello, lastName=World to a function which
prints out lastName followed by firstName.  I would hope that "World
Hello" would be displayed, which is what mono prints.

The Type.InvokeMember documentation also implies that mono's behavior is
the correct behavior.

Could anyone try this under .NET 1.1 and report the results?

 - Jon

On Mon, 2003-04-21 at 09:39, Piyush, Garyali (IE10) wrote:
> Hi,
> 
>  There seems to be a bug in System.Type.InvokeMember. I ran a simple
> program which uses reflection and it produced different results when
> run from Microsoft CLR and mono.
> 
> [code:start]
> 
> using System;
> using System.IO;
> using System.Reflection;
> 
> public class Invoke 
> {
> 	public static void Main(string [] cmdargs)
> 	{
> 		Type t = typeof(TypeClass);
> 
> 		object[] argValues = new object [] {"Hello", "World"};
> 		string [] argNames = new string [] {"firstName",
> "lastName"};
> 
> 		t.InvokeMember("PrintName",
> 				BindingFlags.InvokeMethod,
> 				null,
> 				null,
> 				argValues,
> 				null,
> 				null,
> 				argNames);  
> 	}
> }
> 
> public class TypeClass 
> {
> 	public static void PrintName(string lastName, string firstName)
> 	{
> 	Console.WriteLine(firstName);
> 	Console.WriteLine(lastName);
> 	}
> }
> 
> [code:end]
> 
> [Output]
> 
> Using Microsoft CLR:
> --------------------
> Hello 
> World
> 
> Using mono v0.23
> ---------------------
> World 
> Hello
> 
> 
> If however, the PrintName function is written like :
> 
> public static void PrintName(string firstName, string lastName)
> 
> ,the output matches. I guess there is a bug somewhere but am not sure
> if it is the corlib.dll or the icall InternalInvoke.
> 
> Thanks and regards,
> Piyush Garyali
> Honeywell Labs
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list