Skip to content

Serialize trimmed app publishes to avoid static asset lock races - #68501

Closed
PureWeen wants to merge 1 commit into
mainfrom
pureween-fix-static-assets-lock-race
Closed

PureWeen wants to merge 1 commit into
mainfrom
pureween-fix-static-assets-lock-race

Conversation

@PureWeen

Copy link
Copy Markdown
Member

Summary

Serialize the Components E2E trimmed app project-reference traversal so concurrent publishes cannot write the same static web asset compression intermediate.

Root cause

Build 1552169 failed in Windows local development validation while GlobalizationWasmApp and Wasm.Performance.TestApp publishes overlapped. Both traversed Microsoft.AspNetCore.Components.WebAssembly.csproj and ran GeneratePublishCompressedStaticWebAssets for the same logical _framework/blazor.webassembly.js.map asset. The SDK derives the compressed output identity from the shared asset metadata, so both invocations targeted:

artifacts\obj\Microsoft.AspNetCore.Components.WebAssembly\Release\net11.0\compressed\publish\jpsg8p4gww-{0}-n92mzkaipp-n92mzkaipp.br

The Brotli tool opens outputs with FileMode.Create and has no cross-invocation lock. Current-main build 1552404 reproduced the identical lock after #68463 merged, confirming that the prior Components.TestServer-specific mitigation did not cover the direct trimmed app references.

Correction

Set BuildInParallel=false only when TestTrimmedApps=true. This serializes the Release/CI E2E project references that own the colliding publish traversal while preserving normal Debug/local parallelism.

Validation

  • Release/CI evaluation: TestTrimmedApps=true, BuildInParallel=false
  • Debug/local evaluation: TestTrimmedApps unset, BuildInParallel=true
  • Release E2E project build succeeded: 117 projects, 0 errors
  • Release binlog confirms the E2E ResolveProjectReferences MSBuild task runs with BuildInParallel=False
  • Four-model adversarial review selected this fix over per-publish intermediate isolation and skip/re-publish alternatives because those approaches had unproven property propagation or asset-preservation risks

Limitations

Local validation ran on macOS, so it cannot reproduce the Windows file-sharing exception. The correction is validated structurally through evaluated properties and the MSBuild task parameter; Windows CI remains the behavioral confirmation. This repository workaround addresses the proven E2E ownership boundary but is not a systemic SDK fix for arbitrary concurrent publishes.

Prevent concurrent E2E trimmed app publishes from writing the same static web asset compression intermediates.

Co-authored-by: Copilot App <[email protected]>
Copilot AI lite review requested due to automatic review settings August 13, 2026 19:28
@PureWeen
PureWeen requested a review from a team as a code owner August 13, 2026 19:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR mitigates Windows file-lock races during Components E2E trimmed app publishes by serializing project-reference traversal only in the trimmed-app test configuration, preventing concurrent publishes from writing the same compressed static web asset intermediate outputs.

Changes:

  • Set BuildInParallel=false when TestTrimmedApps=true to serialize project reference builds/publishes for trimmed E2E apps.
  • Document the rationale in the E2E test project file to explain the concurrency constraint.
Show a summary per file
File Description
src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj Disables parallel project-reference traversal when running trimmed app publishes to avoid shared static asset compression intermediate output lock races.

Review details

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

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