[Mono-bugs] [Bug 336841] New: Reflection fail to invoke members with ParamArray attribute

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Oct 25 13:51:46 EDT 2007


https://bugzilla.novell.com/show_bug.cgi?id=336841

           Summary: Reflection fail to invoke members with ParamArray
                    attribute
           Product: Mono: Class Libraries
           Version: 1.2
          Platform: x86
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: mario.chavez at gmail.com
         QAContact: mono-bugs at ximian.com
          Found By: ---


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


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list