[Mono-bugs] [Bug 564843] New: Passing a delegate pointing to null to native causes an abort

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Dec 15 11:09:48 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=564843

http://bugzilla.novell.com/show_bug.cgi?id=564843#c0


           Summary: Passing a delegate pointing to null to native causes
                    an abort
    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: amcgovern at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


I found this while working on moonlight. Essentially if you create a delegate
like this and pass it to native, it causes a crash as seen below. A better
error message would be nice:

public delegate void Test (int param);

[DllImport ("FakeLib.dll")]
static extern void TestMethod (Test func);

PassToNative ()
{
    Test d = null;
    d = new Test (d);
    TestMethod (d);
}


ERROR:marshal.c:8330:mono_marshal_emit_managed_wrapper: code should not be
reached

Program received signal SIGABRT, Aborted.
0x00007ffff6f1f645 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff6f1f645 in raise () from /lib64/libc.so.6
#1  0x00007ffff6f20c33 in abort () from /lib64/libc.so.6
#2  0x00007ffff2bd4203 in g_assertion_message () from
/usr/lib64/libglib-2.0.so.0
#3  0x00007fffddbc29dd in mono_marshal_emit_managed_wrapper (mb=0x20da150,
invoke_sig=0x1e9d308, mspecs=0x20da1a0, m=0x7fffffff8970, method=0x210cd98,
this_loc=0x0) at marshal.c:8330
#4  0x00007fffddbc55d9 in mono_marshal_get_managed_wrapper (method=0x210cd98,
delegate_klass=0x1e9bc50, this_loc=0x0) at marshal.c:8562
#5  0x00007fffddbca046 in mono_delegate_to_ftnptr (delegate=0x7fffdbbbb7e0) at
marshal.c:349
#6  0x000000004001f709 in ?? ()
#7  0x00007fffffff8ad0 in ?? ()
#8  0x00000000019693c0 in ?? ()
#9  0x0000000000000000 in ?? ()

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