https://bugzilla.novell.com/show_bug.cgi?id=367663
Summary: ILGenerator.EmitCalli() doesn't handle null return type.
Product: Mono: Class Libraries
Version: 1.9.0
Platform: Other
OS/Version: Windows Vista
Status: NEW
Severity: Normal
Priority: P5 - None
Component: CORLIB
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
QAContact: [email protected]
Found By: ---
This program dies with an exception on Mono, but runs fine on Windows:
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
class Program
{
static System.Threading.ThreadStart del = Foo;
static void Main()
{
AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly(new
AssemblyName("foo"), AssemblyBuilderAccess.Run);
ModuleBuilder modb = ab.DefineDynamicModule("foo.dll");
TypeBuilder tb = modb.DefineType("Foo");
MethodBuilder mb = tb.DefineMethod("Frub", MethodAttributes.Static, null,
new Type[] { typeof(IntPtr) });
mb.SetImplementationFlags(MethodImplAttributes.NoInlining);
ILGenerator ilgen = mb.GetILGenerator();
ilgen.Emit(OpCodes.Ldarg_0);
// if you pass typeof(void) instead of null, it works
ilgen.EmitCalli(OpCodes.Calli, CallingConvention.StdCall, null,
Type.EmptyTypes);
ilgen.Emit(OpCodes.Ret);
Type type = tb.CreateType();
type.GetMethod("Frub", BindingFlags.NonPublic | BindingFlags.Static)
.Invoke(null, new object[] {
Marshal.GetFunctionPointerForDelegate(del) });
}
static void Foo()
{
}
}
--
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.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs