[Mono-bugs] [Bug 617161] New: NRE in dynamic method with nullable types
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Jun 24 12:38:47 EDT 2010
http://bugzilla.novell.com/show_bug.cgi?id=617161
http://bugzilla.novell.com/show_bug.cgi?id=617161#c0
Summary: NRE in dynamic method with nullable types
Classification: Mono
Product: Mono: Runtime
Version: SVN
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: JIT
AssignedTo: lupus at novell.com
ReportedBy: jbevain at novell.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
The following test case have to be compiled with dmcs, as the bug is triggered
by what the DLR emits.
The SRE code in the test case is only to show what the DLR emits. Apparently
it's the same IL that is emitted in the assembly, and in the dynamic method.
When calling the code from the emitted assembly it works just fine, but the
compiled dynamic method throws an NRE.
Test case:
--
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
public class Test {
public static void Main ()
{
var assembly = AppDomain.CurrentDomain.DefineDynamicAssembly (new
AssemblyName ("repro"), AssemblyBuilderAccess.RunAndSave);
var module = assembly.DefineDynamicModule ("repro.dll");
var type = module.DefineType ("Test", TypeAttributes.Public);
var method = type.DefineMethod ("Method", MethodAttributes.Public |
MethodAttributes.Static, typeof (Func<long?>), new Type[] {typeof (long?)});
var p = Expression.Parameter(typeof(long?), "p");
Expression<Func<Func<long?, long?>>> e4 =
Expression.Lambda<Func<Func<long?, long?>>>(
Expression.Lambda<Func<long?, long?>>(
Expression.Not(p),
new ParameterExpression[] { p }),
Enumerable.Empty<ParameterExpression>());
e4.CompileToMethod (method);
type.CreateType ();
assembly.Save ("repro.dll");
Func<Func<long?, long?>> f4 = e4.Compile ();
Console.WriteLine (object.Equals (f4 () (0), (long?) ~0));
}
}
--
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list