[Mono-dev] NullReferenceException thrown inside catch

Janne Rantala janne.rantala at gmail.com
Fri Aug 25 08:21:04 EDT 2006


> The Windows port seems to use SEH. Maybe a SEH handler
> could be able to catch the exception:
>
> #include <windows.h>
>
> MonoException *ex;
>
> __try {
>         mono_runtime_invoke ( ..., &ex);
> }
> __except (EXCEPTION_EXECUTE_HANDLER) {
>
>         /* simulate a NRE */
>         ex = mono_get_exception_null_reference ();
> }
>
> if (ex != NULL) {
>         handle the exception
> }
>
> The code is for VC++ in C mode (not C++).
>
> Robert
>

Hi,

That works very well, thanks. It would be nice if both Linux and
Windows version would work the same way though.

Janne



More information about the Mono-devel-list mailing list