Fix Blazor web app template Error.razor: make RequestId public for [PersistentState]#66245
Merged
akoeplinger merged 2 commits intomainfrom Apr 10, 2026
Merged
Conversation
3 tasks
…ntState attribute Agent-Logs-Url: https://github.com/dotnet/aspnetcore/sessions/108820f8-6bce-4d6a-abb9-cc9c808fe2cd Co-authored-by: oroztocil <79744616+oroztocil@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix error page opening issue in Blazor web app
Fix Blazor web app template Error.razor: make RequestId public for [PersistentState]
Apr 9, 2026
akoeplinger
approved these changes
Apr 9, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a regression in the Blazor Web App (C#) template where navigating to /Error crashes because a [PersistentState]-annotated property (RequestId) was not publicly readable.
Changes:
- Update
RequestIdfromprivatetopublicso[PersistentState]can bind/restore it correctly.
Comment on lines
31
to
33
| [PersistentState] | ||
| private string? RequestId { get; set; } | ||
| public string? RequestId { get; set; } | ||
|
|
There was a problem hiding this comment.
The template regression was only caught by manual navigation to /Error, and the existing Blazor web template E2E tests don’t appear to exercise this route at all. Consider adding a template test assertion that requesting/navigating to /Error succeeds (e.g., status code OK and page renders) to prevent this from regressing again.
Copilot AI
added a commit
that referenced
this pull request
Apr 10, 2026
Agent-Logs-Url: https://github.com/dotnet/aspnetcore/sessions/be056767-fa7c-43c7-8f71-b1bf9e8fb444 Co-authored-by: akoeplinger <1376924+akoeplinger@users.noreply.github.com>
4 tasks
javiercn
pushed a commit
that referenced
this pull request
Apr 10, 2026
…ersistentState] (#66245) * Initial plan * Fix Error.razor template: make RequestId property public for PersistentState attribute Agent-Logs-Url: https://github.com/dotnet/aspnetcore/sessions/108820f8-6bce-4d6a-abb9-cc9c808fe2cd Co-authored-by: oroztocil <79744616+oroztocil@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: oroztocil <79744616+oroztocil@users.noreply.github.com>
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.
Navigating to
/Errorin a newly scaffolded 11.0 Blazor Server app crashes withInvalidOperationException: A public property 'RequestId' on component type '...Error' with a public getter wasn't found.— a regression introduced when[PersistentState]was added to the template.Description
[PersistentState]requires a public getter, but the template declaredRequestIdasprivate: