[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


http://bugzilla.novell.com/show_bug.cgi?id=591877

http://bugzilla.novell.com/show_bug.cgi?id=591877#c0


           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});
        System.Console.Write("OK");
    }
}


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

Unhandled Exception: System.Reflection.TargetParameterCountException:
parameters
 do not match signature
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags
invok
eAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globa
lization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr,
System.Refle
ction.Binder binder, System.Object[] parameters,
System.Globalization.CultureInf
o culture) [0x00000] in <filename unknown>:0
  at System.Activator.CreateInstance (System.Type type, BindingFlags
bindingAttr
, System.Reflection.Binder binder, System.Object[] args,
System.Globalization.Cu
ltureInfo culture, System.Object[] activationAttributes) [0x00000] in <filename
unknown>:0
  at System.Activator.CreateInstance (System.Type type, System.Object[] args,
Sy
stem.Object[] activationAttributes) [0x00000] in <filename unknown>:0
  at System.Activator.CreateInstance (System.Type type, System.Object[] args)
[0
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