SteveSandersonMS / dotnet-wasi-sdk

Packages for building .NET projects as standalone WASI-compliant modules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question]: Thoughts around possibilities

shaggygi opened this issue · comments

I've been trying to read up in this space as it appears to have great potential. When it comes to C# and .NET, I'm a little confused on the type of scenarios we may get. Understanding this SDK (and standards around WASI and such) are in the early stages and things will change, but could you add somewhere in the project some docs about things to expect (both good and bad).

For example, will it be possible to write and convert small C# code (few classes) into WASM byte code or is the .NET runtime going to be required as well? What are some of the file sizes seen when building average type of app? Would it be possible to run C# code in smaller micros on bare metal like ESP32?

Thanks for any details provided while progress is made. Enjoyed your WASI sessions so far. Keep up the good work. 👍

Will there eventually be ease of adding bindings/support like mentioned here...

bytecodealliance/wasm-micro-runtime#1258

In the long run, alternative .NET compilation technologies such as NativeAOT might get you towards your goal of running tiny snippets of .NET on embedded devices.

The code in this repo is based on the Mono runtime (which is well tested for use on WebAssembly), which does bring in a .NET runtime. I'm not sure which kinds of microcontrollers can run wasm modules in the few-megabytes size range, but those ones should be able to run it.

Will there eventually be ease of adding bindings/support like mentioned here...

In that thread they are talking about embedding WAMR inside Go/C. The equivalent would be embedding WAMR inside .NET. And something very much like that is already possible: the wasmtime NuGet package embeds wasmtime in .NET.

In that thread they are talking about embedding WAMR inside Go/C. The equivalent would be embedding WAMR inside .NET. And something very much like that is already possible: the wasmtime NuGet package embeds wasmtime in .NET.

I was asking more about device bindings we have over in dotnet/iot where we can access hardware like I2C/SPI/GPIO. Rich Lander mentioned on another thread (couldn't find it) that it seems it would be possible where new classes could be added specific for WASM (GpioWasmController, etc.).

Thanks again.

In that case, I think #30 is what you'd want to get from .NET code to arbirary wasm imports/exports, and then it's up to your wasm host to map those imports/exports to whatever native functionality it wants (e.g., GPIO).