[Mono-list] Bug in System.Type.InvokeMember!!
John Duncan
jddst19@mac.com
Mon, 21 Apr 2003 11:25:40 -0400
No, the code sample prints firstName then lastName, but the method's
parameters are positioned lastName,firstName. In an ordinary positional
call, M("Hello","World") would print "World\nHello\n". Passing in the
names of the parameters makes it a named-parameter call. That is why it
should print "Hello\nWorld\n". This would be important functionality for
late-binding VB calls, which allow both named and positional parameters.
John
On Monday, April 21, 2003, at 10:12 AM, Jonathan Pryor wrote:
> 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
>
> _______________________________________________
> Mono-list maillist - Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list