Skip to content

Copy HotReload dll to intermediate to avoid duplicate identity in multi-client WASM#53656

Open
lewing wants to merge 2 commits intomainfrom
fix-hotreload-dll-intermediate
Open

Copy HotReload dll to intermediate to avoid duplicate identity in multi-client WASM#53656
lewing wants to merge 2 commits intomainfrom
fix-hotreload-dll-intermediate

Conversation

@lewing
Copy link
Copy Markdown
Member

@lewing lewing commented Apr 1, 2026

Summary

Copy the HotReload dll to $(IntermediateOutputPath)hotreload/ before adding it to ReferenceCopyLocalPaths, matching the pattern already used for the .js module (sdk#52816).

Problem

In multi-client hosted Blazor WASM scenarios, both clients reference the same HotReload dll from the shared SDK path. During publish, ComputeWasmPublishAssets uses this shared-path item to replace Framework-materialized per-project assets, causing duplicate key crashes in ApplyCompressionNegotiation.

Fix

Copy the dll to obj/{config}/{tfm}/hotreload/ (same as the .js module), then reference from there. Each project gets a unique path.

Context

  • The .js module already uses this pattern (sdk#52816)
  • Traced via binlog: ComputeWasmPublishAssets replaces materialized per-client asset with raw SDK-path item
  • Related: runtime#126211, runtime#125329

The JS module was already copied to $(IntermediateOutputPath)hotreload/
to give each project a unique path (sdk#52816), but the dll was still
referenced directly from the shared SDK path. In multi-client hosted
Blazor WASM scenarios, both clients reference the same SDK-path dll,
which causes ComputeWasmPublishAssets to replace Framework-materialized
per-project assets with the shared path, leading to duplicate Identity
crashes in ApplyCompressionNegotiation.

Copy the dll to intermediate (matching the .js pattern) so each project
gets a unique path. This is the same approach @javiercn recommended for
the JS module in sdk#52816.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings April 1, 2026 13:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the WASM SDK Hot Reload wiring to avoid duplicate-identity issues in multi-client hosted Blazor WebAssembly scenarios during publish by ensuring each project references a project-unique copy of the HotReload DLL.

Changes:

  • Copy Microsoft.DotNet.HotReload.WebAssembly.Browser.dll into $(IntermediateOutputPath)hotreload/ (matching the existing pattern used for the .js module).
  • Update ReferenceCopyLocalPaths to reference the intermediate-copied DLL instead of the shared SDK path.
  • Expand the comment to reflect that both the JS module and DLL are copied to avoid duplicate identity.

Ensures dotnet clean removes the intermediate copy.

Co-authored-by: Copilot <[email protected]>
@lewing
Copy link
Copy Markdown
Member Author

lewing commented Apr 1, 2026

/backport to release/11.0.1xx-preview3

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

Started backporting to release/11.0.1xx-preview3 (link to workflow run)

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