-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling an exported function causes a panic #265
Comments
Hmm, I got it to work by switching over my C# project which gets compiled to WASM to be an Exe instead of a Library, as well as removing the |
You're missing a call to Unfortunately the Wasmtime internals underlying There's no good way for us to improve this experience from the .NET side of things as the callback mechanism by which the linker extracts the WASI configuration from the store is internal to the Wasmtime API and it is expected to panic if the API isn't used properly. |
At a bare minimum, we could at least change the |
I'm trying to compile C# to WASM and then execute that WASM using wasmtime-dotnet but for some reason it panics when trying to invoke the method. Here's the C# code that gets compiled to WASM:
Using some native C to actually get the
SayHello
method to be exported as__say_hello
(I got it to work using this issue on the dotnet-wasi-sdk repo), here is that C:I'm then using the following code to try and invoke the
__say_hello
method:This fails with the exception being
SEHException (0x80004005): External component has thrown an exception.
and the console window shows the following before the stacktrace:Calling the function directly with the wasmtime cli using
wasmtime --invoke __say_hello .\myWasm.wasm
results in the following error:I now found this issue on the ASP.NET Core repo where another user had the same
condition
default_alc' not met, their fix is calling
_startbefore anything else, this sadly does not fix my problem as calling
_startfrom C# fails with
SEHException (0x80004005): External component has thrown an exception.and Rust
thread '' panicked at 'calledOption::unwrap()
on aNone
value', crates\c-api\src\linker.rs:105:80`, however it does work when calling it directly using the wasmtime cli.The text was updated successfully, but these errors were encountered: