Skip to content

Keep reconnected circuits alive after navigation interop timeouts - #69767

Merged
kotlarmilos merged 31 commits into
dotnet:mainfrom
surya3655:69473-navigate
Nov 27, 2026
Merged

kotlarmilos merged 31 commits into
dotnet:mainfrom
surya3655:69473-navigate

Conversation

@surya3655

Copy link
Copy Markdown
Contributor

Description

This change prevents a server-side Blazor circuit from being terminated when a NavigationManager.NavigateTo JS interop call times out after a transient disconnect.

Previously, a navigation request or reply lost while the SignalR connection was unavailable eventually raised a TaskCanceledException. Unless the circuit had been permanently disconnected, that exception reached the generic navigation failure path, raised UnhandledException, and terminated a circuit that could already have reconnected.

The navigation flow now:

  • treats cancellation from a timed-out navigation interop call as a recoverable outcome for a live circuit;
  • logs the timeout as the NavigationTimedOut warning without raising UnhandledException;
  • continues to log navigation attempts on permanently disconnected circuits as NavigationStoppedSessionEnded;
  • preserves the existing failure behavior for unexpected JS interop errors.

The regression coverage includes:

  • focused tests for live-circuit timeouts, permanently disconnected sessions, sessions ending during invocation, successful navigation, and unexpected errors;
  • a Selenium scenario that drops the real Blazor Server connection, issues navigation while disconnected, reconnects the same circuit, waits for the interop timeout, and verifies that the circuit remains interactive;
  • a browser control proving that unexpected navigation interop failures still display the error UI and disconnect the circuit.

Output

Before
05-after-75s

After
05-after-75s
06-after-ping

Validation:

dotnet test src\Components\Server\test\Microsoft.AspNetCore.Components.Server.Tests.csproj --no-restore --filter "FullyQualifiedName~RemoteNavigationManagerTest" -p:UseIisNativeAssets=false -v:minimal
Passed: 5, Failed: 0, Skipped: 0

dotnet build src\Components\test\E2ETest\Microsoft.AspNetCore.Components.E2ETests.csproj --no-restore -v:q -p:UseIisNativeAssets=false
Build succeeded with 0 warnings and 0 errors

dotnet test src\Components\test\E2ETest\Microsoft.AspNetCore.Components.E2ETests.csproj --no-build --filter "FullyQualifiedName~NavigationReconnectionTest"
Passed: 2, Failed: 0, Skipped: 0

Fixes #69473

@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Oct 12, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Oct 12, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Thanks for your PR, @surya3655. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@surya3655
surya3655 marked this pull request as ready for review October 13, 2026 08:57
@surya3655
surya3655 requested a review from a team as a code owner October 13, 2026 08:57
Copilot AI balanced review requested due to automatic review settings October 13, 2026 08:57

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

Recoverable disconnect timeouts currently produce exception-bearing warning telemetry that can create operational noise.

1 open finding
What changed in this PR

Prevents transient navigation interop timeouts from terminating reconnected Blazor Server circuits.

Changes:

  • Treats navigation timeouts as recoverable while preserving unexpected-error handling.
  • Adds deterministic reconnect test infrastructure.
  • Adds unit and Selenium regression coverage.
File Description
ServerStartup.cs Enables specialized test startup configuration.
_ServerHost.cshtml Adds manual reconnection handling for tests.
NavigationReconnectionStartup.cs Configures the reconnect scenario.
NavigationReconnectionComponent.razor Provides test navigation interactions.
NavigationReconnectionCircuitHandler.cs Tracks circuit connection state.
NavigationReconnectionTest.cs Covers browser reconnect and failure behavior.
RemoteNavigationManagerTest.cs Covers navigation outcomes and logging.
RemoteNavigationManager.cs Recovers from navigation interop timeouts.

🧠 Review effort: Balanced


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

…ore-main into 69473-navigate

# Conflicts:
#	src/Components/Server/src/Circuits/RemoteNavigationManager.cs
#	src/Components/Server/test/Circuits/RemoteNavigationManagerTest.cs
#	src/Components/test/E2ETest/ServerExecutionTests/NavigationReconnectionTest.cs
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime.
To make sure no conflicting changes have occurred, please rerun validation before merging. You can do this by leaving an /azp run comment here (requires commit rights), or by simply closing and reopening.

@dotnet-policy-service dotnet-policy-service Bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Oct 22, 2026
@PureWeen

PureWeen commented Nov 1, 2026

Copy link
Copy Markdown
Member

/review

@github-actions github-actions Bot 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.

Source-only review of frozen head 8403c802c004107371116c66179eceff8eb5552b.

One advisory unresolved item is attached inline: the old/new timeout and circuit-lifetime paths are established, but the frozen evidence does not establish the target-version SignalR retained-proxy/drop behavior required to produce the live timeout trigger.

Guide completion

  • docs/CrossCuttingGuidance.md: complete for all in-scope source checks; runtime/test execution and security assessment were excluded by the supplied source-only policy.
  • docs/BlazorComponentsGuidance.md: complete for all in-scope source checks; runtime/test/browser execution was excluded.

Existing feedback coverage: discussion 4256706843 identified warning-level telemetry on an earlier revision; frozen head now logs NavigationTimedOut at Debug. This deduplication is neutral and does not grade the prior review.

Unresolved: Target-version-bound SignalR source, contract, or immutable validation is missing for whether JS.BeginInvokeJS sent through the retained proxy after disconnect is silently dropped and remains unanswered after reconnection.

Discarded source concerns: location-changing cancellation does not reach this catch; unexpected interop failures still reach UnhandledException; permanent-disconnection handling follows the ended-session path; no public API, DI lifetime, resource-leak, or source-level false-pass defect was established.

Provenance and boundary: Bundle v2; merge base c7fc0077f01b1069028af41b1dd90ddc090af63f; base tip and immutable reviewer guidance d8754d1fc8751b5a8ee7e8d0d28df4052cf63e77. Proof is frozen-source-only; PR code, tests, CI, browser workflows, and samples were not executed. The target-version SignalR transport implementation/contract needed for the remaining trigger was not established by the assigned evidence. Tracked Git bytes only; symlink, submodule, and LFS targets are inert.

Generated by ASP.NET Core Pull Request Review for #69767 · copilot · gpt56 · 199.2 AIC · ⌖ 12.5 AIC · ⊞ 18.8K
Comment /review to run again

@PureWeen

Copy link
Copy Markdown
Member

Copilot's local review panel found no issues to raise at this commit.

@kotlarmilos kotlarmilos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!

@kotlarmilos
kotlarmilos merged commit 82c37d3 into dotnet:main Nov 27, 2026
31 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

✅ No documentation PR was created.

Confidence that documentation is needed: 10%

No docs needed: this is a bug fix with test coverage that changes only internal error handling.

Documentation surfaces considered

  • Conceptual article: Not required — Internal bug fix in RemoteNavigationManager.cs; no public API, config, or default changes, and no signals found.
  • Migration guidance: Not required — No user action needed when upgrading.
  • Breaking change: Not required — No compatibility impact; it only avoids terminating circuits on a transient timeout.

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — a657fdad Deployed Nov 27, 2026 by kotlarmilos via conclusion #501
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-reviewed-approved area-blazor Includes: Blazor, Razor Components community-contribution Indicates that the PR has been added by a community member pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun

Projects

None yet

5 participants