Hey all :wave:
I've been experimenting with https://github.com/dotnet/eShop and the viability of compiling some of the microservices there to WASI. I couldn't quite get it working out of the box, but I did try and replicate one of the services to test WASI compatibility.
I'm able to get it to build, but when I try and wasmtime run the component it drops a stacktrace regrading the mono runtime.
➜ WASMTIME_BACKTRACE_DETAILS=1 wasmtime run -Scli -Shttp bin/Release/net10.0/wasi-wasm/publish/dotnet.wasm
/__w/1/s/src/runtime/src/mono/mono/eglib/gmem.c:134 <disabled>
Error: failed to run main module `bin/Release/net10.0/wasi-wasm/publish/dotnet.wasm`
Caused by:
0: failed to invoke `run` function
1: error while executing at wasm backtrace:
0: 0x295512 - abort
at wasisdk://v25.0/build/sysroot/wasi-libc-wasm32-wasip2/libc-bottom-half/sources/abort.c:5:5
1: 0x46613 - monoeg_assert_abort
at /__w/1/s/src/runtime/src/mono/mono/eglib/goutput.c:57:3
- monoeg_log_default_handler
at /__w/1/s/src/runtime/src/mono/mono/eglib/goutput.c:399:3
2: 0x4652a - monoeg_g_logstr
at /__w/1/s/src/runtime/src/mono/mono/eglib/goutput.c:151:2
- monoeg_g_logv_nofree
at /__w/1/s/src/runtime/src/mono/mono/eglib/goutput.c:166:2
3: 0x4663f - monoeg_g_logv
at /__w/1/s/src/runtime/src/mono/mono/eglib/goutput.c:173:10
- monoeg_g_log
at /__w/1/s/src/runtime/src/mono/mono/eglib/goutput.c:182:2
4: 0x4668d - monoeg_g_log_disabled
at /__w/1/s/src/runtime/src/mono/mono/eglib/goutput.c:189:2
5: 0x4622f - monoeg_g_calloc
at /__w/1/s/src/runtime/src/mono/mono/eglib/gmem.c:134:2
6: 0x46244 - monoeg_malloc0
at /__w/1/s/src/runtime/src/mono/mono/eglib/gmem.c:138:9
7: 0x13ad57 - mono_jit_parse_options
at /__w/1/s/src/runtime/src/mono/mono/mini/driver.c:1759:21
8: 0xc729 - dotnet.wasm!main
9: 0x294f80 - dotnet.wasm!__main_void
10: 0xaea7 - _start
at wasisdk://v25.0/build/sysroot/wasi-libc-wasm32-wasip2/libc-bottom-half/crt/crt1-command.c:43:13
11: 0xbd2937 - wit-component:adapter:wasi_snapshot_preview1!wasi:cli/run@0.2.0#run
2: wasm trap: wasm `unreachable` instruction executed
I'm not a C# expert, so would love guidance if I'm missing anything!
Here's the diff / changes if that helps anyone, I compiled with the latest dotnet 10 preview: https://github.com/brooksmtownsend/eShop/compare/main...brooksmtownsend:eShop:feat/wasi?expand=1
@James Sturtevant if you have any thoughts....
From the trace it is hitting an assert in a some default logger? That could be an issue depending on what kind of IO it is doing. Does mono have any environment variable to turn off logging completely? Could also try NAOT to see if it is the same.
@Pavel Šavara might also have an idea....
this looks like OOM with monoeg_malloc0 in the trace.
WASI experiment is on pause on main (mono) repo. You can switch to NAOT_LLVM branch and perhaps get bit further.
The eShop demo's next question would be pgsql connectivity, which depends on missing TLS. There is some work in progress.
Overall, it's too early for such complex app.
Yeah there's plenty of stuff in the eShop that would have trouble with Wasm at the moment. I was hoping to get just part of it working, didn't have an expectation of the postgres / LLM / rabbit MQ pieces quite yet!
FWIW, James and I did a proof-of-concept SqlClient demo with wasi-tls; you might be able to hack something together for pgsql, too, but it would be demoware at this point rather than a supported project.
Last updated: Dec 06 2025 at 06:05 UTC