WACS.ComponentModel 0.7.1

dotnet add package WACS.ComponentModel --version 0.7.1
                    
NuGet\Install-Package WACS.ComponentModel -Version 0.7.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WACS.ComponentModel" Version="0.7.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WACS.ComponentModel" Version="0.7.1" />
                    
Directory.Packages.props
<PackageReference Include="WACS.ComponentModel" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WACS.ComponentModel --version 0.7.1
                    
#r "nuget: WACS.ComponentModel, 0.7.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WACS.ComponentModel@0.7.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WACS.ComponentModel&version=0.7.1
                    
Install as a Cake Addin
#tool nuget:?package=WACS.ComponentModel&version=0.7.1
                    
Install as a Cake Tool

WACS.ComponentModel

WebAssembly Component Model runtime for WACS — WIT parsing, canonical-ABI lift/lower, resource handles, and component instantiation. Layered on the same parse / validate / link pipeline WACS uses for core modules; works with both the interpreter and the AOT transpiler engines.

What's inside

  • Component runtimeComponentInstance.Instantiate, resource registries, variant / option / result / list / record / tuple / flags lift+lower
  • Canonical ABI — full lift/lower including aggregate returns through retArea, UTF-8 / UTF-16 / Latin-1 string encodings, recursive variant arms, instance-method resource calls
  • WIT parser — vendored upstream grammar, WitLoader resolves use chains across packages, embedded WIT files in assemblies via WitContract.FromAssembly
  • ComponentBridge — cross-engine adapter that lets interpreted and transpiled components compose against the same typed contract
  • Linker.Validate(WitContract) — link-time check that bound host implementations match the WIT contract (catches drift before the component runs)

Install

dotnet add package WACS.ComponentModel

Quick start

using Wacs.ComponentModel.Runtime;

var bytes = File.ReadAllBytes("hello.component.wasm");
var ci = ComponentInstance.Instantiate(bytes,
    rt =>
    {
        // configure host bindings on the underlying WasmRuntime
        // — `--bind` shims, WASI Preview 2 hosts, custom IBindables
    });

var result = ci.Invoke("greet", new object?[] { "world" });
Console.WriteLine(result);

For the WASI Preview 2 host implementations (cli / clocks / filesystem / http / io / random / sockets), pair this package with WACS.WASI.Preview2 or WACS.WASI.Preview2.DependencyInjection.

For programmatic WIT ↔ C# binding generation, see WACS.ComponentModel.Bindgen.Lib.

Engines

This package handles the component-model layer; the underlying core wasm executes through either:

  • Interpreter (WACS) — AOT-safe, ~270–385 iter/s on CoreMark, suitable for Unity IL2CPP / PublishAot.
  • Transpiler (WACS.Transpiler.Lib) — Reflection.Emit AOT, ~17 500 iter/s on CoreMark, ~50% of native C speed.

The wacs run --wasip2 CLI verb auto-routes to the transpiler engine when WASI Preview 2 host packages are wired. See the top-level WACS README for the full matrix.

Documentation

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (9)

Showing the top 5 NuGet packages that depend on WACS.ComponentModel:

Package Downloads
WACS.WASI.NN

WASI-NN host bindings for WACS — wasi:nn@0.2.0-rc-2024-10-28 (component-model WIT) plus the legacy wasi_ephemeral_nn (WITX) ABI. Backend-agnostic core; pluggable backends (ML.NET, ONNX Runtime, ONNX Runtime GenAI, LlamaSharp, TorchSharp, OpenVINO) ship as sibling packages. Tracks the wasi-nn proposal at WASI Phase 2 — the WIT surface may change as the proposal evolves.

WACS.Transpiler.Lib

Library API for WACS.Transpiler — programmatic ahead-of-time WebAssembly-to-.NET IL transpilation, plus seamless loading of saved transpiled assemblies. v0.7.2 fixes a re-instantiation bug where Module classes with active data segments would come up zeroed on the second `Activator.CreateInstance` because spec §4.5.4 segment-drop emptied the process-wide ModuleInit registry. Module ctors now restore from `ModuleInitData.SavedDataSegments` before each CopyDataSegment so every fresh instance sees its memory initialized. v0.7 retires Lokad.ILPack for PersistedAssemblyBuilder (.NET 9), moves WASM data segments + the codec blob to RVA-mapped initialized data (62.5% smaller than the prior base64-in-#US path, true zero-copy from PE pages to ModuleInitData via UnmanagedMemoryStream), and introduces EmissionTarget.Auto as the new default — promotes to AotLinked when the module fits a conservative envelope (compute / memory / globals / tables + active+passive segments / multi-memory / local tags / imported functions), falling back to Standard otherwise. ~50% first-trial cold-start cut on promoted modules. ImportDispatcher now throws on missing handlers by default (lenient: true opts out). v0.6 consumed the Branch Hinting proposal's metadata.code.branch_hint custom section. v0.5 added the AotLinked emission target, stable AssemblyName, and the [WacsTranspiledImports] / [WacsImportNames] emission used by WACS.HostBindings.SourceGen.

WACS.WASI.Preview2.DependencyInjection

Microsoft.Extensions.DependencyInjection extension methods for WACS.WASI.Preview2. Registers default host implementations + bindings + a pre-wired Linker.

WACS.WASI.Preview2

WASI Preview 2 (component-model) host implementations for WACS

WACS.WASI.NN.DependencyInjection

Microsoft.Extensions.DependencyInjection extension methods for WACS.WASI.NN. Registers the WasiNNBundle that the transpiler's HostPackageResolver direct-links wasi:nn imports against — symmetric with WACS.WASI.Preview2.DependencyInjection.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.7.1 142 5/18/2026
0.4.0 239 5/16/2026
0.3.5 1,066 5/10/2026
0.3.4 411 5/10/2026
0.1.0 239 5/1/2026