Wasm: execution sequence of finally and filters is wrong
yowl opened this issue · comments
Wasm exception handling, where filters are in in higher catches, is processing the filters after finally
s . This means that this test fails in Wasm: https://stackoverflow.com/questions/57544142/in-c-sharp-try-finally-how-to-catch-the-original-exception/57544409#57544409
This is because Wasm is using a mix of manual handling and leveraging LLVM exceptions. A possible fix could be to store finally blocks (along with the shadow stack pointers) while the filters are evaluated going back up the stack and only execute them once a catch has been found.
Running finally blocks when the exception is not caught anywhere is another case to consider and probably broken currently as well.