WebAssembly for .NET
A library able to create, read, modify, write and execute WebAssembly (WASM) files from .NET-based applications. Execution does not use an interpreter or a 3rd party library: WASM instructions are mapped to their .NET equivalents and converted to native machine language by the .NET JIT compiler.
Available on NuGet at https://www.nuget.org/packages/WebAssembly .
- Use the
WebAssembly.Moduleclass to create, read, modify, and write WebAssembly (WASM) binary files.
Module.ReadFromBinaryreads a stream into an instance, which can then be inspected and modified through its properties.
WriteToBinaryon a module instance writes binary WASM to the provided stream.
- There are no known issues with this functionality and the API is stable.
- Use the
WebAssembly.Runtime.Compileclass to execute WebAssembly (WASM) binary files using the .NET JIT compiler.
- This feature doesn't have 100% spec compliance so it may not work with every WASM you provide.
Please report an issue if you encounter an assembly that works in browsers but not with this library.
Sample: Create and execute a WebAssembly file in memory
Current Development Objectives
Informational; there is no timelime for completion of these items.
- Improve official specification compliance, using Google Chrome as the reference for correct behavior.
- Improve exceptions thrown from problems found during compilation or execution.
- Provide a mechanism to replace the
System.Reflection.Emit.AssemblyBuilder-affiliated methods with replacements so that something like Mono.Cecil can be used to produce a DLL.
- If https://github.com/dotnet/corefx/issues/4491 is fixed, use it to enable saving DLLs.
- Remove the compiler's Data section segment size limit of 4128768 bytes.
- Add support for new WebAssembly features as they become standardized.