Skip to content

[release/11.0.2xx] [dotnet watch] Align mobile WebSocket authentication with WASM browser tools - #56860

Merged
jonathanpeppers merged 1 commit into
release/11.0.2xxfrom
jonathanpeppers-mobile-authentication-backport
Oct 30, 2026
Merged

jonathanpeppers merged 1 commit into
release/11.0.2xxfrom
jonathanpeppers-mobile-authentication-backport

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Summary

Backport of #56722 to release/11.0.2xx as one commit.

  • Use build-owned RSA keys for mobile Hot Reload and verify the provider's secret echo before initialization.
  • Preserve the release branch's newer HotReloadBrowserToolsEnabled check and adapt the renamed shared key reader to its existing overload.
  • Keep browser refresh server behavior and dotnet run -e semantics unchanged. Do not restore the architecture file deleted on this branch.

The WASM key model was introduced in #56118.

Validation

  • Full SDK build passed, including the injected agents for net6.0 and net10.0.
  • 125 focused tests passed: WebSocket authentication, key loading and lifecycle, mobile watch updates and restart, browser server and build outputs, and an ILLink regression check.
  • Added checks for the adapted browser key reader and direct AssignTargetPaths, DeployToDevice, and ComputeRunArguments calls without a build.
  • Real-device execution was not performed.

…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>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 18:08
@azure-pipelines

Copy link
Copy Markdown
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.

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.

🟡 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>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

@jonathanpeppers
jonathanpeppers enabled auto-merge (squash) October 30, 2026 21:07
@jonathanpeppers
jonathanpeppers merged commit 916059f into release/11.0.2xx Oct 30, 2026
29 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-mobile-authentication-backport branch October 30, 2026 21:22

This branch had an error being deployed

1 failed deployment
copilot-pat-pool — 5a1a4f7d Deployed Oct 30, 2026 by jonathanpeppers via pre_activation #11450
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants