[Mono-bugs] [Bug 463323] Bug with delegates to dynamic methods

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 10 16:49:24 EST 2009


User amirshim at yahoo.com added comment

--- Comment #13 from Amir Shimoni <amirshim at yahoo.com>  2009-02-10 14:49:22 MST ---
In the process of trying to make the bug reproducible, I managed to discover
another bug that belongs to this bug heading.  Here is the code:

using System;
using System.Linq.Expressions;

namespace MonoBug
   class Program
      public void testFunc() {}
      static void Main()
      // the commented line doesn't have any problems...
      // Expression<System.Func<Program, Action>> action = (d =>
      //   (Action)Delegate.CreateDelegate(typeof(Action), d,"testFunc" ));

         Expression<System.Func<Program, Action>> action = (d => d.testFunc);
         var t = action.Compile();
         Program p = new Program();

It works with no problems on MS.net. It also works with delegates instead of
the expression/compile() pair.  But under the mono runtime, it creates this

Unhandled Exception: System.ArgumentException: method argument length mismatch
at System.Delegate.CreateDelegate
(System.Type,object,System.Reflection.MethodInfo,bool) [0x00266] in
at System.Delegate.CreateDelegate
(System.Type,object,System.Reflection.MethodInfo) [0x00000] in
at (wrapper dynamic-method)
(System.Runtime.CompilerServices.ExecutionScope,MonoBug.Program) <IL 0x00015,
at MonoBug.Program.Main () [0x000ac] in /tmp/test1/Program.cs:18

This is not the original bug, but is a "Bug with delegates to dynamic methods",
that might be closely related, and/or could lead to the original bug.

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