|
Bugzilla – Full Text Bug Listing |
| Summary: | The runtime crashes when an NRE is raised from native code during variable evaluation. | ||
|---|---|---|---|
| Product: | [Mono] Mono: Runtime | Reporter: | Levi Bard <taktaktaktaktaktaktaktaktaktak> |
| Component: | debug | Assignee: | Mono Bugs <mono-bugs> |
| Status: | NEW --- | QA Contact: | Mono Bugs <mono-bugs> |
| Severity: | Critical | ||
| Priority: | P5 - None | CC: | forgotten_vxPDddArjq, joncham |
| Version: | 2.6.x | ||
| Target Milestone: | --- | ||
| Hardware: | x86-64 | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
| Found By: | --- | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
Converting SIGSEGVs in native code to NREs was never supported in mono. If it worked, it only worked by accident. This isn't converting a sigsegv to an NRE - this is explicitly raising a NullReferenceException using mono_raise_exception() Sorry, misread your report. I'm having trouble debugging stuff on windows, so somebody with windows experience needs to track this down. I tried reproducing it with:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
__declspec(dllexport)
void Foo ()
{
printf ("HIT!\n");
void* exception = mono_exception_from_name_msg (mono_get_corlib
(), "System", "NullReferenceException", "");
mono_raise_exception (exception);
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
and:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
using System;
using System.Runtime.InteropServices;
public class Tests
{
// C# Code
[DllImport("blah")]
public static extern void Foo ();
public static void Main () {
//Foo ();
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
and invoking 'Foo' using the sdb api seems to work fine in HEAD.
I can reproduce this now. Dunno what changed. I take that back. Recompiling the native library made it work again. I can't repro this using 2.6 either. Could this be a win7/wow64 etc. problem ? This could definitely be a win7/wow64 problem - as far as I recall, all of our repro cases have been in that environment. |
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 The runtime crashes when a null reference exception is raised from native code during variable evaluation. Appears to happen only on windows (I'm using a 32bit embedded mono runtime on windows 7 x86-64). Spent quite a bit of time trying to debug this - it appears that the exception gets handled normally in the runtime itself, but the crash occurs when transitioning back to native code: i.e., the handler code seems to execute up to restore_context(), but the debugger agent code never executes anything after mono_runtime_invoke. // C Code void throw_native_exception () { MonoException* exception = mono_exception_from_name_msg (mono_get_corlib (), "System", "NullReferenceException", ""); mono_raise_exception (exception); } // C# Code [DllImport(blah)] public static extern void throw_native_exception(); public int throw_managed_exception() { string s = null; return s.Length; } Reproducible: Always Steps to Reproduce: Create an embedded project that invokes some managed code. Run with sdb, break inside the managed code. In the immediate window, ?throw_managed_exception() will fail gracefully. In the immediate window, ?throw_native_exception() will crash the runtime. (This also affects hover-inspection, watch pad, etc., in MD.)