[Mono-bugs] [Bug 591877] New: error passing var-args via Activator.CreateInstance

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Mar 29 10:27:16 EDT 2010



           Summary: error passing var-args via Activator.CreateInstance
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: i686
               URL: http://jira.codehaus.org/browse/BOO-1293
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: kvarkus at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User
           Blocker: Yes

Description of Problem:
Can't create an external class with variable arguments number.

Steps to reproduce the problem:
//test case
public class Y    {
    public Y(params int[] par)    {}
class X {
    static void Main () {
        Y x = new Y(1,2);
        System.Activator.CreateInstance(x.GetType(), new System.Object[]{2,3});

Actual Results:
Code compiles, but gives the following exception on execution:

Unhandled Exception: System.Reflection.TargetParameterCountException:
 do not match signature
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags
eAttr, System.Reflection.Binder binder, System.Object[] parameters,
lization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr,
ction.Binder binder, System.Object[] parameters,
o culture) [0x00000] in <filename unknown>:0
  at System.Activator.CreateInstance (System.Type type, BindingFlags
, System.Reflection.Binder binder, System.Object[] args,
ltureInfo culture, System.Object[] activationAttributes) [0x00000] in <filename
  at System.Activator.CreateInstance (System.Type type, System.Object[] args,
stem.Object[] activationAttributes) [0x00000] in <filename unknown>:0
  at System.Activator.CreateInstance (System.Type type, System.Object[] args)
x00000] in <filename unknown>:0
  at X.Main () [0x00000] in <filename unknown>:0

Expected Results:
Code runs successfully, creating an instance of Y.

How often does this happen? 

Additional Information:
The bug was originally faced in Boo's external AST attribute application (with
variable arguments)(see attached URL).

Configure bugmail: http://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