Repository navigation
Fix UnoWasmChecker for modern .NET 8+ apps - #1034
Conversation
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.
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-river-0087b630f-1034.eastus2.1.azurestaticapps.net |
There was a problem hiding this comment.
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
resourcesformats. - 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
GetUnoConfignow supportsconfig.dotnet_js_filename, but the early-exit condition still requiresassembliesto be non-null. On modern apps whereconfig.assemblies_with_sizeis 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 + eitherdotnet_js_filenameoruno_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.
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-river-0087b630f-1034.eastus2.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-river-0087b630f-1034.eastus2.1.azurestaticapps.net |
There was a problem hiding this comment.
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.
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.
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-river-0087b630f-1034.eastus2.1.azurestaticapps.net |
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.
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-river-0087b630f-1034.eastus2.1.azurestaticapps.net |
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.
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-river-0087b630f-1034.eastus2.1.azurestaticapps.net |
There was a problem hiding this comment.
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.
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-river-0087b630f-1034.eastus2.1.azurestaticapps.net |
|
@Mergifyio backport release/stable/10.0 |
✅ Backports have been createdDetails
|
…0.0/pr-1034 Fix UnoWasmChecker for modern .NET 8+ apps (backport #1034)
Summary
The
uno-wasm-versiontool (UnoVersionExtractor) no longer works with modern Uno WASM apps (e.g. https://nuget.info/) because:assemblies_with_sizeanduno_mainwere removed fromuno-config.js—ShellTask.csno longer generates these fields (removed in commit 12a666f, Sept 2024).blazor.boot.jsonno longer exists — .NET 8+ embeds the boot configuration directly inside_framework/dotnet.jsbetween/*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
GetDotnetConfigFromDotnetJs()method that fetches_framework/dotnet.js, extracts the embedded JSON boot config via regex, and parses assemblies and metadata from it.ExtractAssembliesFromResources()helper that handles both the new array format ([{"virtualPath":"X.wasm","name":"X.abc.wasm"}]) and the old object format ({"X.dll": "sha256-..."}).Extract()flow to try the modern dotnet.js path first, then fall back toblazor.boot.jsonfor older apps.UnoConfigto parseconfig.dotnet_js_filenamefromuno-config.js.DotnetConfigwithdebugLevelandlinkerEnabledfields.OutputResults().Backward compatibility
All three config formats are supported:
Verified against