[Mono-dev] Patch to add support to execute methods withParamArray thought Reflection
Mario A Chavez
mario.chavez at gmail.com
Thu Oct 25 13:56:24 EDT 2007
Bug 336841 has been created
https://bugzilla.novell.com/show_bug.cgi?id=336841
On Oct 25, 2007, at 10:40 AM, Gert Driesen wrote:
> Mario,
>
> Please submit a bug report for this, and add your patch as an
> attachment.
>
> Gert
>
> From: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-
> list-bounces at lists.ximian.com] On Behalf Of Mario Chavez
> Sent: donderdag 25 oktober 2007 8:31
> To: mono-devel-list at lists.ximian.com
> Subject: Re: [Mono-dev] Patch to add support to execute methods
> withParamArray thought Reflection
>
>
> This new diff fix a issue with boo, the problem is related to
> methods with zero parameters but parameters are passed when calling
> SelectMethod in Binder.cs
>
> Mario
>
> On 10/24/07, Mario Chavez <mario.chavez at gmail.com> wrote:
> Hi;
>
> Currently reflection does not support methods that have ParamArray
> attribute to be called with InvokeMember, like:
>
> ... some class
> public static void TestMethod(params string[] param1)
> {
> Console.WriteLine("Test Method 3, one params");
> }
> .... some class
>
> Type type = typeof(ParamArrayTest);
> object obj = type.InvokeMember("TestMethod",
> InvokeBindingFlags, null, null, new object[] {"param1"});
>
> it fails with:
>
> Unhandled Exception: System.MissingMethodException: The best match
> for method TestMethod 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) [0x00000]
> at System.Type.InvokeMember (System.String name, BindingFlags
> invokeAttr, System.Reflection.Binder binder, System.Object target,
> System.Object[] args) [0x00000]
> at ParamArrayTest.Main (System.String[] args) [0x00000]
>
> This patch for Binder.cs and MonoType.cs allows this type of
> calling, which by the way does work on MS .NET
>
> I hope that this patch is good enough to go into Mono
>
> Thanks
> --
> Mario Chavez
> mario.chavez at gmail.com
> http://mario-chavez.blogspot.com/
>
>
>
> --
> Mario Chavez
> mario.chavez at gmail.com
> http://mario-chavez.blogspot.com/
Mario A Chavez
mario.chavez at gmail.com
http://mario-chavez.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071025/787b8087/attachment.html
More information about the Mono-devel-list
mailing list