[Mono-dev] Catching NRE in Embedded Mono

Robert Jordan robertj at gmx.net
Mon Jan 9 11:04:08 UTC 2012


On 09.01.2012 02:02, Jeff Ward wrote:
> I'm using embedded mono in an application, and I want to be able to catch
> when I have a Null reference in Mono.  At the moment, it looks like mono is
> crashing on a null reference (maybe sending SIGSEGV?).  I'd like to catch
> these exceptions in the unmanaged layer so I can at least grab a call stack.

A SIGSEGV escaping the runtime means that your app is either
overriding Mono's SIGSEGV handler (crash reporter?), or the
runtime is crashing due to a SIGSEGV in native code.
This is untrappable.

In all other cases, NullReferenceExceptions are returned
back like any other exception via a MonoException** pointer
(see the last arg of mono_runtime_invoke).

Robert



More information about the Mono-devel-list mailing list