dotnet-webassembly icon indicating copy to clipboard operation
dotnet-webassembly copied to clipboard

Legacy Exception Handling

Open GerardSmit opened this issue 3 years ago • 1 comments

This PR implements https://github.com/WebAssembly/exception-handling. The following is done:

Module structure

  • [x] Tags
    • [ ] Clean-up
    • [ ] Import
    • [ ] Export
    • [ ] Name section

Control flow operators

  • [x] try
  • [x] catch
  • [x] catch_all
  • [ ] delegate
  • [x] throw
  • [x] rethrow

Other tasks

  • [x] Fix possible out of range exceptions (when the tag index is out of range).
  • [ ] Resolve all TODO's in code:
    • [ ] Verify expected result type if there is no value
    • [ ] Validate for invalid tags in throw and catch
    • [ ] Validate for invalid argument types in throw

In C# I've created a WebAssemblyException which is thrown by the IL generator.
If the exception has parameters, the generic type will be used (WebAssemblyException<T0> and WebAssemblyException<T0, T1>. This is to prevent boxing.

GerardSmit avatar Dec 28 '22 00:12 GerardSmit

As noted in #59, I don't want to merge the WebAssembly. prefixing in the OpCode XML due to that being a Rider bug. Any chance you could rebase without those changes to cut down on the size of this PR? Other than that, I'm pretty excited about what you've accomplished here.

RyanLamansky avatar Jan 03 '23 00:01 RyanLamansky