Skip to content

Discard abandoned SSR output when a component redirects mid-render - #10221

Merged
wtgodbe merged 1 commit into
mainfrom
wtgodbe/port-3387893-main
Oct 14, 2026
Merged

wtgodbe merged 1 commit into
mainfrom
wtgodbe/port-3387893-main

Conversation

@wtgodbe

@wtgodbe wtgodbe commented Oct 14, 2026

Copy link
Copy Markdown
Member

Prevents prerendering from reading uninitialized render tree frames.

Description

When a component redirects while its children are being initialized, the current render tree diff is abandoned. Preserve the navigation exception until pending non-streaming work is drained, then discard the abandoned output and return the redirect result. Includes regression coverage for GET and form POST rendering paths.

Fixes dotnet/aspnetcore#69035

Customer Impact

Prevents prerendering from walking an incomplete render tree, re-entering the root component, and terminating the process with a stack overflow.

Regression?

  • Yes
  • No

No known previously supported behavior regressed.

Risk

  • High
  • Medium
  • Low

The change is limited to redirect handling after an abandoned render. Existing redirect handling is reused, and targeted regression tests cover both affected paths.

Verification

  • Manual (required)
  • Automated

Targeted regression tests were added. Manual verification was not performed locally because the branch-pinned SDK was unavailable.

Packaging changes reviewed?

  • Yes
  • No
  • N/A

No packaging changes.

…cts mid-render

# Discard abandoned SSR output when a component redirects mid-render

Prevents prerendering from reading uninitialized render tree frames

## Description

When a component redirects while its children are being initialized, the current render tree diff is abandoned. Preserve the navigation exception until pending non-streaming work is drained, then discard the abandoned output and return the redirect result. Includes regression coverage for GET and form POST rendering paths.

Fixes #69035

## Customer Impact

Prevents prerendering from walking an incomplete render tree, re-entering the root component, and terminating the process with a stack overflow.

## Regression?

- [ ] Yes
- [x] No

No known previously supported behavior regressed.

## Risk

- [ ] High
- [ ] Medium
- [x] Low

The change is limited to redirect handling after an abandoned render. Existing redirect handling is reused, and targeted regression tests cover both affected paths.

## Verification

- [ ] Manual (required)
- [x] Automated

Targeted regression tests were added. Manual verification was not performed locally because the branch-pinned SDK was unavailable.

## Packaging changes reviewed?

- [ ] Yes
- [ ] No
- [x] N/A

No packaging changes.

----

## When servicing release/2.3

- [ ] Make necessary changes in eng/PatchConfig.props

Not applicable to this release branch.

Co-authored-by: Copilot <[email protected]>
@wtgodbe
wtgodbe requested review from javiercn and a balanced review from Copilot October 14, 2026 16:10
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team October 14, 2026 16:10
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 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

Redirect handling abandons the full-quiescence task, allowing pending work and unobserved faults to outlive the request.

1 open finding
What changed in this PR

Defers redirect handling until non-streaming SSR work drains, then discards abandoned output.

Changes:

  • Preserves and rethrows navigation exceptions after draining pending work.
  • Discards invalid render output for redirects.
  • Adds GET and POST regression tests.
File Description
EndpointHtmlRenderer.Prerendering.cs Defers navigation exceptions during pending-work draining.
RazorComponentEndpointInvoker.cs Replaces abandoned output with redirect output.
RazorComponentEndpointInvokerTest.cs Covers redirects during GET and form POST rendering.

🧠 Review effort: Balanced


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

@wtgodbe
wtgodbe merged commit 6aa3f99 into main Oct 14, 2026
12 checks passed
@wtgodbe
wtgodbe deleted the wtgodbe/port-3387893-main branch October 14, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants