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

Piyush, Garyali (IE10) Piyush.Garyali@honeywell.com
Mon, 21 Apr 2003 19:09:05 +0530


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