[Mono-dev] Embedded mono crash on exception
Trigve Siver
trigves at yahoo.com
Thu Aug 6 11:13:43 UTC 2015
----- Original Message -----
> From: Robert Jordan <robertj at gmx.net>
> To: mono-devel-list at lists.ximian.com
> Cc:
> Sent: Thursday, August 6, 2015 10:31 AM
> Subject: Re: [Mono-dev] Embedded mono crash on exception
>
> On 06.08.2015 08:12, Trigve wrote:
>> I'm using embedded mono (using unity) in C++ DLL. I'm calling some
> managed
>> functions using mono_runtime_invoke(). The function does throw an
> exception,
>> which I caught with the MonoException argument. Then I want to unwind stack
>> (in C++) so I throw my custom exception. But application crashes at address
>> 00000000 (last function on the stack is ExecuteHandler2 at 20()). So it looks
>> like some exception handler is set pointing to the NULL.
>
>
> I'm pasting this from the Nabble Forum because it didn't make
> into the mail:
>
>
>> First-chance exception at 0x7548C42D in Unity.exe: Microsoft C++ exception:
> ExceptionAlreadySet at memory location 0x0028D63C.
>>
>> First-chance exception at 0x00000000 in Unity.exe: 0xC0000005: Access
> violation executing location 0x00000000.
>
> Not sure about Unity's Mono (it's a customized version) but
> "First-chance exception at 0x00000000" is usually not an error,
> at least not in the old Mono version Unity is using.
>
> This exception is an artifact of Mono's NullReferenceException handling.
> You are supposed to ignore it.
>
Thanks for the reply,
yes I know that mono handle the access violation as NullReferenceException. But I'm not sure this is the case. Because the whole application crashed. But this only happens only after the mono_runtime_invoke() returns the exception. If no exception is returned, and I throw C++ exception, everything is working right. Also if you notice the call stack, the crash happens at calling the NULL location in exception handler, so to me it looks like some memory corruption or what. But I can't pinpoint the source of it.
Here is the call stack from the original mail:
00000000() Unknown
[Frames below may be incorrect and/or missing]
ntdll.dll!ExecuteHandler2 at 20() Unknown
ntdll.dll!ExecuteHandler at 20() Unknown
ntdll.dll!_RtlDispatchException at 8() Unknown
ntdll.dll!_KiUserExceptionDispatcher at 8() Unknown
KernelBase.dll!_RaiseException at 16() Unknown
msvcr120d.dll!_CxxThrowException(void * pExceptionObject=0x0028d658, const _s__ThrowInfo * pThrowInfo=0x2313ffe0) Line 154 C++
Thanks
Trigve
More information about the Mono-devel-list
mailing list