[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


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

User amirshim at yahoo.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=463323#c13





--- 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();
         t(p);
      }
   }
} 


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

Unhandled Exception: System.ArgumentException: method argument length mismatch
at System.Delegate.CreateDelegate
(System.Type,object,System.Reflection.MethodInfo,bool) [0x00266] in
/mnt/photos1/dist/monosvn/mcs/class/corlib/System/Delegate.cs:259
at System.Delegate.CreateDelegate
(System.Type,object,System.Reflection.MethodInfo) [0x00000] in
/mnt/photos1/dist/monosvn/mcs/class/corlib/System/Delegate.cs:263
at (wrapper dynamic-method)
System.Runtime.CompilerServices.ExecutionScope.lambda_method
(System.Runtime.CompilerServices.ExecutionScope,MonoBug.Program) <IL 0x00015,
0x00079>
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