Skip to content

Fix UnoWasmChecker for modern .NET 8+ apps - #1034

Merged
carldebilly merged 8 commits into
mainfrom
dev/cdb/wasm-version
Feb 16, 2026
Merged

carldebilly merged 8 commits into
mainfrom
dev/cdb/wasm-version

Conversation

@carldebilly

Copy link
Copy Markdown
Member

Summary

The uno-wasm-version tool (UnoVersionExtractor) no longer works with modern Uno WASM apps (e.g. https://nuget.info/) because:

  1. assemblies_with_size and uno_main were removed from uno-config.js — ShellTask.cs no longer generates these fields (removed in commit 12a666f, Sept 2024).
  2. blazor.boot.json no longer exists — .NET 8+ embeds the boot configuration directly inside _framework/dotnet.js between /*json-start*/ and /*json-end*/ markers.

The tool was outputting "No assemblies found" and exiting with error code 1 on all modern deployments.

What changed

  • Added a new GetDotnetConfigFromDotnetJs() method that fetches _framework/dotnet.js, extracts the embedded JSON boot config via regex, and parses assemblies and metadata from it.
  • Added a shared ExtractAssembliesFromResources() helper that handles both the new array format ([{"virtualPath":"X.wasm","name":"X.abc.wasm"}]) and the old object format ({"X.dll": "sha256-..."}).
  • Reordered the Extract() flow to try the modern dotnet.js path first, then fall back to blazor.boot.json for older apps.
  • Extended UnoConfig to parse config.dotnet_js_filename from uno-config.js.
  • Extended DotnetConfig with debugLevel and linkerEnabled fields.
  • Added display of globalization mode, linker status, and debug level in OutputResults().

Backward compatibility

All three config formats are supported:

  • Modern apps (dotnet.js embedded boot config) — new path
  • Older apps (blazor.boot.json) — existing fallback
  • Legacy apps (assemblies_with_size in uno-config.js) — existing path

Verified against

Site Assemblies App Runtime Config source
nuget.info 143 PackageExplorer 7.0.7 .NET 10.0 dotnet.js (new)
gallery.platform.uno 98 Uno.Gallery 1.7.0-dev.1 .NET 9.0 blazor.boot.json
playground.platform.uno 97 Uno.Playground.WASM 1.4.0-dev.325 .NET 9.0 blazor.boot.json

Modern Uno WASM apps embed the boot configuration directly inside
_framework/dotnet.js between /*json-start*/ and /*json-end*/ markers
instead of using blazor.boot.json. This change adds support for
extracting assemblies and metadata from the embedded boot config,
with fallback to blazor.boot.json for older apps.
@github-actions

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the UnoVersionExtractor in uno-wasm-version to work with modern .NET 8+ (and newer) Uno WASM deployments by extracting the embedded boot configuration from _framework/dotnet.js, while keeping fallbacks for older blazor.boot.json and legacy uno-config.js formats.

Changes:

  • Added extraction/parsing of the embedded boot JSON from _framework/dotnet.js, and updated extraction flow to try this path first.
  • Introduced a shared helper to extract assembly lists from both the old object-shaped and new array-shaped resources formats.
  • Extended config parsing/output to include dotnet_js_filename, globalization mode, linker enabled, and debug level.
Comments suppressed due to low confidence (1)

src/Uno.Wasm.VersionChecker/UnoVersionExtractor.cs:417

  • GetUnoConfig now supports config.dotnet_js_filename, but the early-exit condition still requires assemblies to be non-null. On modern apps where config.assemblies_with_size is removed, this loop will always scan the entire file even after all needed fields are found. Consider updating the break condition to stop once the required keys for the current extraction paths are collected (e.g., managed/app base + either dotnet_js_filename or uno_main).
			if (managePath is { } && packagePath is { } && mainAssembly is { } && assemblies is { })
			{
				break;
			}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Refactor UnoVersionExtractor to expose testable static methods
(ExtractBootConfigFromScript, ParseUnoConfigFields,
ExtractAssembliesFromResources) and add 19 unit tests covering
JSON parsing, boot config extraction, and uno-config parsing.

Add CI validation of embedded boot config markers in dotnet.js
via MSBuild AfterPublishValidation and a bash script.

Address review feedback: remove unused AssemblyDownloadInfo,
narrow exception handling in GetDotnetConfigFromDotnetJs, and
fix mainAssemblyName comparison by stripping file extension.
@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread build/scripts/validate-boot-config.sh Resolved
Use perl -0777 for multiline JSON extraction in validate-boot-config.sh
(sed cannot handle JSON spanning multiple lines, causing CI failure).

Include dotnetJsFilename in ParseUnoConfigFields early-break condition
so it is always captured regardless of field order in uno-config.js.

Remove unreachable catch (JsonException) in GetDotnetConfigFromDotnetJs
since ExtractBootConfigFromScript already handles JSON parse failures.
@github-actions

Copy link
Copy Markdown

Rewrite to reflect the current tool behavior: modern .NET 8+ boot
config extraction, WebCIL support, updated console output columns
(Build, Commit), and new diagnostic fields (globalization, linker,
debug level). Remove shell prompt prefix from code blocks to fix
copy-paste. Add supported formats table, exit codes reference, and
update command.
Show dnx as the primary way to run the tool without installation,
as introduced in .NET 10.
@github-actions

Copy link
Copy Markdown

Add blank lines before lists (MD032) and replace bold-as-heading
with proper heading levels (MD036) in spec.md and README.md.
Add Newtonsoft and Linq to cspell dictionary.
@github-actions

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Remove dotnetJsFilename from early-break condition so legacy configs
without that field still benefit from early termination. Add null
checks for packagePath/managePath in GetUnoConfig to prevent
NullReferenceException with incomplete configs.
@github-actions

Copy link
Copy Markdown

@carldebilly
carldebilly merged commit c2da7c8 into main Feb 16, 2026
12 checks passed
@carldebilly
carldebilly deleted the dev/cdb/wasm-version branch February 16, 2026 18:59
@jeromelaban

Copy link
Copy Markdown
Member

@Mergifyio backport release/stable/10.0

@mergify

mergify Bot commented Feb 20, 2026 •

Copy link
Copy Markdown

backport release/stable/10.0

✅ Backports have been created

Details

jeromelaban added a commit that referenced this pull request Feb 20, 2026
…0.0/pr-1034

Fix UnoWasmChecker for modern .NET 8+ apps (backport #1034)
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.

3 participants