You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In transitions to native code in Mono we use C++ catch via LLVM, that translates to WASM catch instruction/block.
This would not be necessary for JSImport/JSExport interop, because we catch and marshal exceptions in JS.
But any exceptions in native code called by P/Invoke/Qcall/Fcall/Icall (including emscripten and browser errors) would trap if not handled. So I think we will need something similar when we call out.
@janvorli said JS exception in DLLImport is undefined behavior - he is right
but the lived reality is that people have native code that calls JS directly and propagates JS exceptions.
The key trick there is to abort posix/"process" when it happens, so that you don't get crazy behavior from subsequent calls into broken/corrupted system and silly bug reports.
Activity
[-]exception handling[/-][+][wasm coreclr] exception handling[/+]dotnet-policy-service commentedon Mar 19, 2025
Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.
pavelsavara commentedon Aug 29, 2025
In transitions to native code in Mono we use C++
catchvia LLVM, that translates to WASM catch instruction/block.This would not be necessary for JSImport/JSExport interop, because we catch and marshal exceptions in JS.
But any exceptions in native code called by P/Invoke/Qcall/Fcall/Icall (including emscripten and browser errors) would trap if not handled. So I think we will need something similar when we call out.
runtime/src/mono/mono/mini/llvm-runtime.cpp
Lines 42 to 50 in 2562b73
runtime/src/mono/mono/mini/llvm-runtime.cpp
Lines 58 to 66 in 2562b73
pavelsavara commentedon Apr 10, 2026
@janvorli said JS exception in DLLImport is undefined behavior - he is right
but the lived reality is that people have native code that calls JS directly and propagates JS exceptions.
The key trick there is to abort posix/"process" when it happens, so that you don't get crazy behavior from subsequent calls into broken/corrupted system and silly bug reports.
Set interpreter context for WASM exception dispatch
dotnet-policy-service commentedon Apr 15, 2026
Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.
pavelsavara commentedon Jul 14, 2026
Is there anything remaining for this one @radekdoulik ?