[Mono-bugs] [Bug 655439] New: Delegate.CreateDelegate is less strict than MS, but invocation is incorrect

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 23 03:43:49 EST 2010


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

https://bugzilla.novell.com/show_bug.cgi?id=655439#c0


           Summary: Delegate.CreateDelegate is less strict than MS, but
                    invocation is incorrect
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: xacc.ide at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User
           Blocker: ---


Description of Problem:

Delegate.CreateDelegate is less strict than MS. Consider the following:

public static void Foo(params object[] args)
{
  Console.WriteLine(args);
}

static void Main(string[] args)
{
  var r = Delegate.CreateDelegate(typeof(Action),
typeof(Program).GetMethod("Foo")) as Action;

  r();
}

On MS, this fails with:

Unhandled Exception: System.ArgumentException: Error binding to target method.
   at System.Delegate.CreateDelegate(Type type, MethodInfo method, Boolean
throwOnBindFailure)
   at ConsoleApplication1.Program.Main(String[] args)

On Mono it success, all good now, but when invoked (as in r()), 'null' is
passed to the method, instead of new object[0].

Actual Results:

'param object[] args' is null

Expected Results:

'param object[] args' is should be 'object[0]'

-- 
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