Skip to content

fix: Resolve the published dotnet.js from the endpoints manifest - #1098

Merged
MartinZikmund merged 10 commits into
mainfrom
dev/mazi/dotnetjs-stale-fingerprint
Oct 7, 2026
Merged

MartinZikmund merged 10 commits into
mainfrom
dev/mazi/dotnetjs-stale-fingerprint

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

Fixes #1089

Stacked on #1088 (same target). Retarget to main once #1088 is merged; CI only runs for PRs into main.

What changed

Publishing into a folder that wasn't cleaned leaves dotnet.*.js files from earlier publishes in _framework. _UnoUpdateDotnetJsFingerprintPublishOutput globbed them and kept the last match, so uno-config.js could name a previous build's dotnet.js. The app then ran the old runtime and assemblies, and UNOWASM002 didn't catch it since the stale file exists.

  • Root cause: a new ResolvePublishedDotnetJsTask_v0 reads the SDK's *.staticwebassets.endpoints.json. Every publish rewrites it, and it maps the _framework/dotnet.js route to the current dotnet.<fingerprint>.js. In .NET 10 the nested AOT publish runs inside the publish pipeline, before the manifest is written, so it holds for AOT too.
  • Without a manifest, a single candidate is used. If there are several, it reports UNOWASM003 and uses the newest, which is best effort only.
  • CI: Uno.Wasm.Bootstrap.UnitTests used the VSTest runner, which global.json's Microsoft.Testing.Platform setting rejects, and no pipeline ran it. It now uses MSTest.Sdk, like the VersionChecker tests, and runs in the packages stage. All 55 existing and new tests pass.
  • Docs: the fingerprinting page explains the behavior and UNOWASM003.

Validation

New Test 9 in test-fingerprint.sh: publish with -p:Version=2.0.0, 1.0.0, 3.0.0, 1.0.0 into the same folder, then assert uno-config.js names the dotnet.js the endpoints manifest maps. The sequence ends on a revert, whose unchanged file keeps an old timestamp, so a "newest file" heuristic would fail it too.

  • Before the fix (Windows, .NET 10.0.400): 3 candidates; uno-config.js named dotnet.ir6qu6j5lh.js, while the manifest mapped dotnet.cnla3mvfkt.js.
  • After the fix, the full script (Tests 1–9) passes locally.
  • Unit tests for the resolver (Given_DotnetJsResolver) cover the manifest, base path routes, a missing file and unfingerprinted outputs.

Related, not changed here: the WebWorker path has the same dirty-folder problem in the worker project's own publish folder. Its existing check fails the build with UNOWA0011 instead of picking a wrong file.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N5azy6DU7ujLte16VPVYQs

Copilot AI balanced review requested due to automatic review settings October 1, 2026 11:42
@MartinZikmund MartinZikmund self-assigned this Oct 1, 2026
@mergify

mergify Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

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.

Copilot review overview

🟡 Changes recommended

Missing-manifest-asset handling can still select a stale runtime, and the required specification is absent.

Review effort: Balanced
Findings: 2 High severity · 2 Low severity

Open (4)
What changed in this PR

Resolves stale dotnet.js selection by using the SDK endpoints manifest and adds validation coverage.

Changes:

  • Adds manifest-based fingerprint resolution with fallback diagnostics.
  • Adds unit, integration, and CI test coverage.
  • Documents dirty publish-directory behavior.
File Description
test-fingerprint.sh Tests repeated publishing.
ResolvePublishedDotnetJsTask.cs Integrates manifest resolution with MSBuild.
DotnetJsResolver.cs Implements fingerprint selection.
Uno.Wasm.Bootstrap.targets Uses the resolver during publish.
Uno.Wasm.Bootstrap.UnitTests.csproj Migrates to MSTest.Sdk.
Given_DotnetJsResolver.cs Tests resolver behavior.
features-dotnetjs-fingerprinting.md Documents resolution and diagnostics.
stage-build-packages.yml Runs bootstrap unit tests in CI.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Base automatically changed from dev/mazi/fingerprint-assets-off to main October 7, 2026 15:48
@MartinZikmund
MartinZikmund added this pull request to stack #1106 October 7, 2026 15:49
MartinZikmund and others added 6 commits October 7, 2026 17:49
Publishing into a directory that wasn't cleaned leaves dotnet.*.js files from
earlier publishes in _framework. The publish target globbed them and kept the
last match, so uno-config.js could point at a previous build's runtime while
the existence check still passed.

Read the SDK's *.staticwebassets.endpoints.json instead, which every publish
rewrites and which maps _framework/dotnet.js to the current file. Without a
manifest, a single candidate is trusted; several produce UNOWASM003 and the
newest is used.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N5azy6DU7ujLte16VPVYQs
Uno.Wasm.Bootstrap.UnitTests used the VSTest runner, which global.json's
Microsoft.Testing.Platform setting rejects, and no pipeline ran it. Move it to
MSTest.Sdk like the VersionChecker tests and run it in the packages stage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N5azy6DU7ujLte16VPVYQs
Fail when the mapped file is missing instead of using a stale candidate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01G7PsEU6gSpLZXrYuK8WWpt
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/dotnetjs-stale-fingerprint branch from 4208749 to c6a1df4 Compare October 7, 2026 15:49
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Copilot AI balanced review requested due to automatic review settings October 7, 2026 16:48

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

MartinZikmund and others added 3 commits October 7, 2026 21:36
A manifest left behind by a renamed project, or another project published
to the same directory, could map dotnet.js to a stale file that still
exists. The project's own manifest now wins when it maps dotnet.js; the
others are only used otherwise, newest first. A manifest that isn't valid
JSON is ignored with UNOWASM005 instead of failing the build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013terw2KRvw8e64cogQymUL
Copilot AI balanced review requested due to automatic review settings October 7, 2026 19:36

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

@MartinZikmund
MartinZikmund merged commit 29cce4f into main Oct 7, 2026
18 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/dotnetjs-stale-fingerprint branch October 7, 2026 21:06
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.

Publishing into a non-empty folder can point uno-config.js at the previous build's dotnet.js

3 participants