Repository navigation
[release/11.0.2xx] [dotnet watch] Align mobile WebSocket authentication with WASM browser tools - #56860
Merged
jonathanpeppers merged 1 commit intoOct 30, 2026
Conversation
…on with WASM browser tools Backport #56722. Preserve the release branch browser availability check and add focused checks for the adapted browser key reader and direct build, deploy, and run target ordering. (cherry picked from commit a138b01) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
jonathanpeppers
requested review from
a team,
lbussell,
mthalman and
tmat
as code owners
October 30, 2026 18:08
|
Azure Pipelines: Successfully started running 2 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Keys generated by ComputeRunArguments without a build are not tracked for cleanup, so Clean leaves them behind and subsequent invocations reuse them instead of rotating them.
1 open issue
What changed in this PR
Backports mobile Hot Reload authentication to the build-owned RSA key model used by browser tools, while preserving the release branch’s browser-tools activation check and existing dotnet run -e behavior.
Changes:
- Shares key generation and validation between mobile and Static Web Assets build tasks.
- Requires the mobile agent to verify the provider’s secret echo before initialization.
- Adds authentication, key-lifecycle, and standalone-target tests, and updates related documentation.
| File | Description |
|---|---|
| test/TestAssets/TestProjects/WatchMobileApp/WatchMobileApp.csproj | Adds runtime-environment capability to the mobile test asset. |
| test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/EnsureHotReloadBrowserToolsKeyTest.cs | Tests shared key-file write failures. |
| test/Microsoft.NET.Sdk.StaticWebAssets.Tests/HotReloadBrowserToolsIntegrationTest.cs | Updates a key-contract comment. |
| test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs | Tests key pinning, reuse, cleanup, and standalone targets. |
| test/Microsoft.Extensions.DotNetDeltaApplier.Tests/WebSocketTransportTests.cs | Covers authentication, invalid echoes, fragmentation, and timeouts. |
| test/Microsoft.DotNet.HotReload.Client.Tests/Web/SharedSecretBuildOutputsTests.cs | Renames reader tests and verifies browser key paths. |
| test/dotnet-watch.Tests/HotReload/MobileHotReloadTests.cs | Checks bootstrap values do not leak into build processes. |
| src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets | Generates mobile keys and supplies the runtime public key. |
| src/Tasks/Microsoft.NET.Build.Tasks/Microsoft.NET.Build.Tasks.csproj | Includes shared key-handling source. |
| src/Tasks/Microsoft.NET.Build.Tasks/EnsureHotReloadWebSocketKey.cs | Adds the mobile key-generation task. |
| src/StaticWebAssetsSdk/Tasks/Microsoft.NET.Sdk.StaticWebAssets.Tasks.csproj | Includes shared key-handling source. |
| src/StaticWebAssetsSdk/Tasks/EnsureHotReloadBrowserToolsKey.cs | Delegates key handling to the shared helper. |
| src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.HotReload.targets | Updates the key-contract comment. |
| src/StaticWebAssetsSdk/AGENTS.md | Documents shared key handling. |
| src/Dotnet.Watch/Watch/Browser/SharedSecretBuildOutputsExtensions.cs | Renames the adapter while retaining the activation check. |
| src/Dotnet.Watch/Watch/AppModels/WebApplicationAppModel.cs | Uses the renamed key reader. |
| src/Dotnet.Watch/Watch/AppModels/MobileAppModel.cs | Supplies mobile build-key paths to the transport. |
| src/Dotnet.Watch/HotReloadClient/WebSocketClientTransport.cs | Loads build keys, echoes secrets, and rejects additional connections. |
| src/Dotnet.Watch/HotReloadClient/Web/SharedSecretBuildOutputs.cs | Generalizes the key reader for browser and mobile outputs. |
| src/Dotnet.Watch/HotReloadAgent.Host/WebSocketTransport.cs | Verifies the provider’s echo before initialization. |
| src/Dotnet.Watch/AGENTS.md | Updates the shared-reader reference. |
| src/Common/HotReloadKeyPair.cs | Centralizes key creation, validation, and reuse. |
| documentation/specs/dotnet-watch-for-maui.md | Describes build-owned keys and the authentication exchange. |
Review effort: Balanced
| <FileWrites Include="$(_HotReloadWebSocketKeyDirectory)websocket-key.public.json; | ||
| $(_HotReloadWebSocketKeyDirectory)websocket-key.private.json" /> | ||
| </ItemGroup> | ||
| </Target> |
Member
Author
There was a problem hiding this comment.
ComputeRunArguments is normally called after a build, even dotnet run --no-build will only work if you previously built.
I don't think it's worth introducing a target that runs before CoreClean.
tmat
approved these changes
Oct 30, 2026
jonathanpeppers
enabled auto-merge (squash)
October 30, 2026 21:07
jonathanpeppers
deleted the
jonathanpeppers-mobile-authentication-backport
branch
October 30, 2026 21:22
jonathanpeppers
had a problem deploying
to
copilot-pat-pool
October 30, 2026 21:22 — with
GitHub Actions
Failure
This branch had an error being deployed
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
Backport of #56722 to
release/11.0.2xxas one commit.HotReloadBrowserToolsEnabledcheck and adapt the renamed shared key reader to its existing overload.dotnet run -esemantics unchanged. Do not restore the architecture file deleted on this branch.The WASM key model was introduced in #56118.
Validation
net6.0andnet10.0.AssignTargetPaths,DeployToDevice, andComputeRunArgumentscalls without a build.