Skip to content

NetWasm 0.6.0: C# Web Workers, Wasm Interop and Library Improvements

Choose a tag to compare

@zion-sati zion-sati released this 04 Oct 17:28
1f68040

NetWasm 0.6.0 adds three major capabilities: C# Web Workers, broader Wasm interop, and the compiler and library support needed by real package workloads. It preserves closed-world, pay-as-you-use output.

Highlights

  • C# Web Workers: publish either a portable WIT worker or a direct JSExport worker from the netwasm-app template. The SDK generates the JavaScript client, worker bootstrap, deployment manifest, lifecycle handling, notifications, and managed failure propagation. See the C# Web Workers guide.
  • Wasm interop: bundle application-owned JavaScript imports, expose managed JSExport entry points, define language-neutral WIT worker contracts, and link supported native C APIs from Wasm .a archives.
  • Library improvements: bounded user-defined attribute queries and expression trees unlock validation-library patterns; CBOR date/time and exception-region fixes support System.Formats.Cbor; secure randomness, Interlocked, type metadata, enum, delegate, and compatibility APIs broaden the usable package surface.

New compiler and CoreLib capabilities

  • Added bounded custom-attribute queries for framework and user-defined attributes, including DescriptionAttribute, closed generic query sites, inheritance rules, constructor and named-argument materialization, and the FluentValidation FlagsAttribute pattern. Runtime-selected targets and filters remain diagnosed instead of silently returning incomplete results. #61
  • Added the bounded expression-tree execution profile used by validation libraries, including Expression.Equal, property access, calls, construction, invocation, conversions, and interpreted lambdas. #65
  • Added bounded UnsafeAccessor support for generated constructor, method, and field accessors. #42
  • Added the public System.Security.Cryptography.RandomNumberGenerator surface backed by host-provided secure entropy. #50
  • Completed the portable Interlocked operation family for NetWasm's single-reactor execution model, preserving ordinary .NET return values and edge cases without claiming shared-memory threading. #67
  • Expanded static native C interop for linked Wasm archives, including supported scalar, pointer, by-reference, struct, union, counted-array, UTF-8, SafeHandle, and callback shapes.

Browser hosting and application templates

  • Applications can declare page-owned JavaScript import modules with NetWasmWorkerJavaScriptModule; the SDK bundles them into the generated browser bootstrap under their declared module names. #47
  • Added WIT and JSExport worker templates. The JSExport client provides explicit call, disposal, termination, managed-failure, and pending-call lifecycle behavior. #48
  • Clarified command versus async-command, raw versus component packaging, and when application-owned JavaScript imports require raw output. #46

Diagnostics and failure handling

  • Debug managed stack traces can now include portable-PDB source files and sequence-point line numbers. Missing symbols fall back to method-only or numeric frames. Debug enables rich diagnostics by default; Release includes them only when NetWasmManagedStackTrace is explicitly enabled. The instrumentation, compact lookup data, and sidecar are omitted when disabled. #64
  • Raw and component hosts now preserve managed-failure classification and report the exception type and available message independently of stack-trace instrumentation. #45
  • Unobserved task diagnostics retain the original exception details through finalization while keeping reporting non-terminating. #44
  • dotnet run now propagates guest exit codes and host or contract failures to the outer process. #60

Compiler and runtime fixes

  • Preserved mutable struct receiver and by-reference aliasing when values are captured by exception filters. #40
  • Fixed struct-producing calls in filter funclets by retaining their planned value-frame and temporary layout. #41
  • Fixed exception-region structuring when a protected region and loop share an entry block; this unblocks CborReader.SkipValue and ReadEncodedValue. #63
  • Preserved closed generic substitutions through FluentValidation rule execution instead of producing an open !0 layout. #66
  • Added the invariant date/time formatting and exact DateTimeOffset parsing behavior required by CBOR date tags, including optional fractions, Z, numeric offsets, span overloads, and strict round-trip matching. #62
  • Added the expected CLS declaration to the CoreLib reference assembly while retaining diagnostics for genuinely non-CLS public APIs. #68

SDK and packaging fixes

  • Fixed central package-version and VersionOverride handling during pack. #51
  • Fixed PackagePath handling for omitted, empty, relative, and directory destinations. #52
  • Fixed partial PrivateAssets conversion into nuspec asset filters. #53
  • Fixed analyzer project-reference target selection under netwasm0.1. #54
  • Removed unavailable optional HTTP and LINQ namespaces from the base implicit-using set. #56
  • Documented why AssetTargetFallback and PackageTargetFallback remain unavailable for the exact NetWasm target profile. #55

Qualification and size

The release qualification completed 2,259 compiler/runtime cases plus package-consumer and host validation. The optimized Release Hello World component is 84,653 bytes, which is 140 bytes (+0.17%) above NetWasm 0.5.0’s 84,513-byte result. The increase comes from ArgumentNullException.ThrowIfNull preserving caller-expression parameter names through ParamName and Message, which is observable .NET behavior. Structured exception diagnostics and managed stack-trace instrumentation remain absent from this Release artifact when disabled.