Repository navigation
Discard abandoned SSR output when a component redirects mid-render - #10221
Merged
Merged
Conversation
…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]>
|
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. |
Contributor
There was a problem hiding this comment.
🟡 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.
javiercn
approved these changes
Oct 14, 2026
This was referenced Oct 19, 2026
This was referenced Oct 27, 2026
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.

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?
No known previously supported behavior regressed.
Risk
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
Targeted regression tests were added. Manual verification was not performed locally because the branch-pinned SDK was unavailable.
Packaging changes reviewed?
No packaging changes.