Fix WASM boot config ContentRoot to use IntermediateOutputPath#124125
Merged
lewing merged 18 commits intodotnet:mainfrom Mar 2, 2026
Merged
Fix WASM boot config ContentRoot to use IntermediateOutputPath#124125lewing merged 18 commits intodotnet:mainfrom
lewing merged 18 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Blazor WASM SDK targets to define the build boot config static web asset from its actual on-disk generation location (obj/) to prevent stale-asset Identity selection during incremental builds (which can lead to incorrect SRI integrity values at runtime).
Changes:
- Change
DefineStaticWebAssetsContentRootfor the build boot config asset from$(OutDir)wwwrootto$(IntermediateOutputPath).
lewing
added a commit
that referenced
this pull request
Feb 8, 2026
Canceled AzDO jobs (typically from timeouts) still have pipeline artifacts containing binlogs. The SendToHelix.binlog contains Helix job IDs that can be queried directly to recover actual test results. Discovered while investigating PR #124125 where a 3-hour timeout caused a WasmBuildTests job to be canceled, but all 226 Helix work items had actually passed.
lewing
added a commit
that referenced
this pull request
Feb 8, 2026
Canceled AzDO jobs (typically from timeouts) still have pipeline artifacts containing binlogs. The SendToHelix.binlog contains Helix job IDs that can be queried directly to recover actual test results. Discovered while investigating PR #124125 where a 3-hour timeout caused a WasmBuildTests job to be canceled, but all 226 Helix work items had actually passed.
Member
Author
Canceled WasmBuildTests actually passed ✅The browser-wasm windows Release WasmBuildTests job in build 1284169 was canceled after the 3-hour timeout, but all Helix work items completed successfully. Recovery steps:
The failure was purely the AzDO job wrapper timing out while waiting to collect results, not an actual test failure. |
lewing
added a commit
that referenced
this pull request
Feb 8, 2026
Canceled AzDO jobs (typically from timeouts) still have pipeline artifacts containing binlogs. The \SendToHelix.binlog\ contains Helix job IDs that can be queried directly to recover actual test results. ## What changed - Added **Recovering Results from Canceled Jobs** section to helix skill SKILL.md - Documents the workflow: download artifacts → load binlog → extract Helix job IDs → query Helix API - Includes concrete example from PR #124125 (226 work items all passed despite 3h timeout cancellation) - Added tip about binlog MCP server for structured binlog analysis ## Context Discovered while investigating #124125 where \�rowser-wasm windows Release WasmBuildTests\ was canceled after 3 hours. The script reported no failures (correct — no *failed* jobs) but also couldn't surface that the tests actually passed. With the documented recovery workflow, the Helix results were fully recoverable.
javiercn
reviewed
Feb 9, 2026
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Show resolved
Hide resolved
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs
Show resolved
Hide resolved
…ation - ComputeWasmPublishAssets: Match RelatedAsset by full filename with extension instead of base name only, with webcil .wasm->.dll normalization to avoid ambiguity between .dll/.pdb files sharing the same base name. - LinkContentToWwwroot: Normalize relative ItemSpec paths to absolute using MSBuildProjectDirectory when computing ContentRoot, preventing incorrect paths when working directory differs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
420afbe to
80ab512
Compare
Member
Author
|
Addressed CCA review feedback in latest commit:
|
Resolve conflict in Microsoft.NET.Sdk.WebAssembly.Browser.targets: - Adopt upstream Webcil casing (lowercase 'c') for property names - Keep PR's removal of _WasmBuildOuputPath - Fix casing in per-item ContentRoot Update lines to match Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs
Outdated
Show resolved
Hide resolved
The upstream Webcil casing change renamed the property to IsWebcilEnabled (lowercase 'c'), but the conflict resolution left references using the old IsWebCilEnabled casing, causing CS0103 build errors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…PublishAssets.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs
Outdated
Show resolved
Hide resolved
PR dotnet#124905 renamed IsWebCilEnabled to IsWebcilEnabled on main. The merge auto-resolved the parameter name but the error message string interpolation still referenced the old casing. Also improved the error message to include asset details and used 'is null' pattern. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
/ba-g failure is an OOM we see without this PR too |
This was referenced Mar 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix a .NET 11 regression causing SRI integrity failures during incremental Blazor WASM builds. Changes in
Microsoft.NET.Sdk.WebAssembly.Browser.targets:DefineStaticWebAssetsContentRootfrom$(OutDir)wwwrootto$(IntermediateOutputPath)%(FileName)%(Extension)-based scanning with direct references to the boot config output itemsContentRoot="%(RootDir)%(Directory)"on_WebCilAssetsCandidatesso each asset's Identity resolves to its actual file path on diskContentRoot="%(RootDir)%(Directory)"on both_NewWebCilPublishStaticWebAssetsCandidatesNoMetadataand_PromotedWasmPublishStaticWebAssets— the same fix applied to publish candidatesRegression
This is a regression in .NET 11 (works in 10.0). It was introduced by dotnet/sdk#52283, which fixed an esproj compression bug by flipping the order in
AssetToCompress.TryFindInputFilePathto preferRelatedAsset(Identity) overRelatedAssetOriginalItemSpec. That fix was correct for esproj, but exposed a latent issue in the WASM SDK targets: the boot config and webcil assets' Identity pointed to awwwrootcopy rather than the actual source files.Before sdk#52283,
OriginalItemSpechappened to point to the real file and was checked first, masking the wrongContentRoot. After the flip,RelatedAsset(Identity) is checked first, and its stalewwwrootpath is used — producing incorrect SRI hashes on incremental builds.Reported in aspnetcore#65271.
Problem
The WASM boot config file (e.g.
dotnet.boot.js) is generated at$(IntermediateOutputPath)(theobj/folder), but its static web asset was defined withContentRoot="$(OutDir)wwwroot". This causedDefineStaticWebAssetsto compute an Identity pointing to thewwwrootcopy rather than the actual file inobj/.The same issue applied to WebCil asset candidates — files from
obj/webcil/, the runtime pack, and other directories were all defined withContentRoot="$(OutputPath)wwwroot", producing synthetic Identities underwwwroot/that could become stale during incremental builds.Fix
1. Boot config ContentRoot
Change
ContentRootto$(IntermediateOutputPath)so the asset Identity matches the real file location on disk. TheCopyToOutputDirectory="PreserveNewest"attribute still ensures the file is copied towwwrootfor serving.This follows Javier's suggestion in dotnet/sdk#52847 to "stop defining these assets with an item spec in the wwwroot folder and just define them in their original location on disk".
2. Preload matching simplification
The
_AddWasmPreloadBuildPropertiesand_AddWasmPreloadPublishPropertiestargets previously scanned all@(StaticWebAsset)items by%(FileName)%(Extension)to find the boot config asset. This relied on the Identity path containing the fingerprint in the filename, which is an implementation detail of howDefineStaticWebAssetscomputes Identity based onContentRoot.The fix replaces the scanning with direct references to
@(_WasmBuildBootConfigStaticWebAsset)and@(_WasmPublishBootConfigStaticWebAsset)— the output items already produced byDefineStaticWebAssets. This is both correct and simpler.3. WebCil per-item ContentRoot (build-time)
Instead of using a single task-level
ContentRootparameter (which forces all candidates through the same ContentRoot path, causing synthesized Identity for files outside that directory), set per-itemContentRoot="%(RootDir)%(Directory)"on each_WebCilAssetsCandidatesitem. This means:obj/webcil/→ ContentRoot = their parent dir →FullPath.StartsWith(ContentRoot)= true → Identity = real FullPath ✅dotnet.native.js, ICU.dat) → ContentRoot = their parent dir in the runtime pack →FullPath.StartsWith(ContentRoot)= true → Identity = real FullPath ✅No synthesized paths, no CopyCandidate entries — every asset's Identity is its actual file on disk.
4. WebCil per-item ContentRoot (publish-time)
The publish
DefineStaticWebAssetscall inProcessPublishFilesForWasmpreviously had no ContentRoot at all — neither task-level nor per-item. This caused publish candidates (especially promoted build assets with fingerprint placeholders in their RelativePath) to have their fingerprinted filename baked into the item spec as Identity, producing paths likedotnet.native.7z98fd2ohl.wasmthat don't exist on disk → MSB3030 "Could not copy file".The fix adds per-item
ContentRoot="%(RootDir)%(Directory)"on both:_NewWebCilPublishStaticWebAssetsCandidatesNoMetadata(freshly WebCil-converted publish files)_PromotedWasmPublishStaticWebAssets(build assets promoted to publish)Why this works: Promoted assets carry
AssetKind=Buildfrom the build-timeDefineStaticWebAssets. InDefineStaticWebAssets.csline 252:IsPublish("Build") = false, so contentRoot is NOT nulled for publish. The per-item ContentRoot = each file's parent directory →candidateFullPath.StartsWith(contentRoot)= true →computed=false→ Identity = real FullPath on disk.What's not changed
ContentRoot="$(PublishDir)wwwroot"): Publish builds are clean and don't have the incremental staleness problem.Build Progression
Fixes dotnet/aspnetcore#65271