http://bugzilla.novell.com/show_bug.cgi?id=528118
Summary: Delegates to a static method closed over the 1st
parameter don't work (when the 1st parameter is a
value type and the 1st argument isn't?)
Classification: Mono
Product: Mono: Compilers
Version: 2.4.x
Platform: x86-64
OS/Version: Debian Potato
Status: NEW
Severity: Normal
Priority: P5 - None
Component: C#
AssignedTo: [email protected]
ReportedBy: [email protected]
QAContact: [email protected]
Found By: ---
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.12)
Gecko/2009070811 Ubuntu/9.04 (jaunty) Firefox/3.0.12
c...@dlrci:~/src$ cat breakme.cs
using System;
public class Foo { public static void Main(string[] args) {
Func<object[], object> x = (Func<object[],
object>)Delegate.CreateDelegate(
typeof(Func<object[], object>),
0,
typeof(Foo).GetMethod("ArgumentRead"));
}
public static object ArgumentRead(object value, object[] args) {
return args[(int)value];
}
}
c...@dlrci:~/src$ gmcs --version && gmcs -out:breakme.exe breakme.cs && mono
breakme.exe ; echo $?
Mono C# compiler version 2.4.2.3
breakme.cs(3,40): warning CS0219: The variable `x' is assigned but its value is
never used
Compilation succeeded - 1 warning(s)
Unhandled Exception: System.ArgumentException: method arguments are
incompatible
at System.Delegate.CreateDelegate (System.Type type, System.Object
firstArgument, System.Reflection.MethodInfo method, Boolean throwOnBindFailure)
[0x00000]
at System.Delegate.CreateDelegate (System.Type type, System.Object
firstArgument, System.Reflection.MethodInfo method) [0x00000]
at Foo.Main (System.String[] args) [0x00000]
1
c...@dlrci:~/src$ . /usr/src/devenv-trunk.sh && gmcs --version && gmcs
-out:breakme.exe breakme.cs && mono breakme.exe ; echo $?
Mono C# compiler version 2.5.0.0
breakme.cs(3,40): warning CS0219: The variable `x' is assigned but its value is
never used
Compilation succeeded - 1 warning(s)
0
Reproducible: Always
Steps to Reproduce:
1.
2.
3.
--
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.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs