Skip to content

Run the kernel as WebAssembly in the Linux CI (#412) - #484

Open
dsn27 wants to merge 5 commits into
integration/issue-412from
test/wasm-smoke
Open

dsn27 wants to merge 5 commits into
integration/issue-412from
test/wasm-smoke

Conversation

@dsn27

@dsn27 dsn27 commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Part of #412 (step 9, verification).

Base: this PR targets integration/issue-412, because it needs both the font service (#466 → #472) and the picture and page setup changes (#473, #474), which are only combined there. Its own diff is just the smoke test. Retarget it to master once those PRs are merged.

Why

The goal of #412 is that CADability runs in the browser. So far that was argued, not shown. This PR runs CADability.dll in the browser runtime of .NET (WebAssembly, under Node.js) in every Linux CI run.

What

tests/CADability.WasmSmoke is a .NET 10 WebAssembly program (Microsoft.NET.Sdk.WebAssembly). It references CADability.csproj and runs 13 checks, without a frame and without GDI+:

  1. register a font from bytes; there are no system fonts in the browser
  2. create a project
  3. make a box minus a cylinder and check the volume
  4. measure a text and get its glyph outlines
  5. create a picture from PNG bytes
  6. paint the model through RecordingPaintTo3D, an IPaintTo3D of its own that replays display lists, and check the painted extent
  7. JSON round trip
  8. open a 1.x file with pictures
  9. open a 1.x file with page settings
  10. open Volumes.cdb.json
  11. import a STEP file
  12. export DXF and STL, and read the DXF back
  13. run the finalizers

The exit code is the number of failed checks. A new step in linux-ci.yml builds the program and runs it with node, which is preinstalled on the runner.

Result

Kernel Passed Failed
master (checks adapted to the old API) 6 7: PlatformNotSupportedException from System.Drawing.Common for text, picture and finalizers, and failures that follow from them
integration/issue-412 13 0

What this shows for the plan

  • Implementing IPaintTo3D works in the browser. RecordingPaintTo3D implements the interface unchanged, including PrepareBitmap(Bitmap) and Text(…, FontStyle, …). Naming GDI+ types in signatures is fine there; only creating GDI+ objects fails. So a browser front end can be written against the 1.x API, and the breaking step 8 (dropping System.Drawing.Common) is not needed for the browser.
  • Pictures are only painted as their outline in such a renderer, because IPaintTo3D has only Bitmap members for images (0 bitmap calls in the run). Showing the image itself needs the optional image interface discussed for Make CADability.dll platform independent: remove GDI+ from the core, porting the ShapeIt work #412; that is a separate PR.

Notes

  • No workload is needed. The plain WebAssembly SDK of .NET 10 builds it.
  • The project is not added to CADability.sln, so building the solution in Visual Studio does not require the WebAssembly SDK.
  • No change to CADability.dll or its public API.

Testing

Locally on Linux: dotnet build -c Release and node bin/Release/net10.0/wwwroot/main.mjs give "All checks passed." and exit code 0. The same program against master gives exit code 7.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YXvDW91oXpy7RquGHNxgR5


Generated by Claude Code

tests/CADability.WasmSmoke builds CADability.dll into a .NET WebAssembly
program and runs it under Node.js, the runtime a browser front end uses.
Without a frame and without GDI+ it registers a font from bytes, builds a
solid with a boolean operation, measures a text and a picture, paints the
model through an IPaintTo3D of its own (as a browser renderer would),
saves and reads JSON, opens project files of 1.x with pictures and page
settings, imports STEP, exports DXF and STL, and runs the finalizers.

The renderer implements IPaintTo3D as it is, with Bitmap and FontStyle in
its signatures: naming GDI+ types is fine in the browser, only creating
GDI+ objects fails. This shows that the browser does not need the
breaking step 8 of #412.

On master, 7 of the 13 checks fail with PlatformNotSupportedException from
System.Drawing.Common; with the open #412 pull requests all pass.

The project needs no workload and is not part of CADability.sln.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YXvDW91oXpy7RquGHNxgR5
@dsn27
dsn27 force-pushed the integration/issue-412 branch from a0e12b1 to 28591f9 Compare October 16, 2026 08:14

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants