Skip to content

Release 1.1.1 - #20

Merged
FlorianRappl merged 15 commits into
mainfrom
devel
Nov 12, 2026
Merged

FlorianRappl merged 15 commits into
mainfrom
devel

Conversation

@FlorianRappl

Copy link
Copy Markdown
Collaborator

Types of Changes

Prerequisites

Please make sure you can check the following two boxes:

  • I have read the CONTRIBUTING document
  • My code follows the code style of this project

Contribution Type

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue, please reference the issue id)
  • New feature (non-breaking change which adds functionality, make sure to open an associated issue first)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Description

This pull request introduces a new resource-limiting feature for the WebAssembly runtime in AngleSharp.Wasm, adds comprehensive tests for these limits, fixes a type issue with host import arguments, and updates documentation and build infrastructure to support trimming and Native AOT compatibility. The main themes are improved runtime security and compatibility, enhanced testing, and CI workflow updates.

FlorianRappl and others added 14 commits November 2, 2026 00:43
- Mark the net8.0 and net10.0 targets IsAotCompatible, so the trim and AOT
  analyzers run on every build, with the same KnownILLinkPack override as
  AngleSharp, AngleSharp.Xml, AngleSharp.Css and AngleSharp.Io
- Update AGENTS.md and CHANGELOG.md

No code changes were needed: both targets build without trim or AOT
warnings, and a console app published with PublishAot (runtime API, DOM
bridge, host imports, CompileError) compiles without warnings, Wasmtime
included, and runs correctly.
The switch expression in ConvertArguments had int, long, float and double
arms, so C# gave it the common type double: every argument reached the
import callback as a boxed double, and i64 values above 2^53 lost
precision. Box each arm as object instead, so i32, i64, f32 and f64
arrive as int, long, float and double.
WebAssembly from a page could grow its memory to 4 GiB and run an endless
loop that nothing can interrupt. WasmtimeWasmRuntimeOptions adds three
opt-in limits, all off by default so existing behavior is unchanged:

- MaximumMemorySize and MaximumTableElements, applied with
  Store.SetLimits to every instance's store
- Fuel, a per-call budget refilled when the host calls into an instance
  (and before instantiation, for the start function); calls a host
  import makes back into the same instance share the outer budget, so
  they cannot reset it

The options are accepted by WasmtimeWasmRuntime, WasmtimeWasmRuntimeFactory
and a new WithWasm(WasmtimeWasmRuntimeOptions) overload. A failed
instantiation now disposes its store right away.
Make the library trim and Native AOT compatible
Pass host import arguments with their WebAssembly types
WasmtimeStoreContext.Run takes the state as a parameter, so every call site
uses a static lambda and the default (no limits) path allocates nothing extra
per call. Measured with BenchmarkDotNet against devel: per-call allocation is
identical, time within 0-2.4%.
The options hold no Wasmtime types and the limits apply to any runtime, so
the name stays independent of the Wasmtime implementation, as suggested in
the review.
Add optional memory, table and fuel limits to the Wasmtime runtime
@FlorianRappl FlorianRappl added this to the v1.1.1 milestone Nov 12, 2026
@FlorianRappl
FlorianRappl merged commit df5952b into main Nov 12, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants