-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Add CreateScopeForStatusCodePages property and UseStatusCodePagesWithReExecute overload #62624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Greetings human! You've submitted a PR that modifies code that is shared with https://github.com/dotnet/runtime . Please make sure you synchronize this code with the changes in that repo! |
@copilot I updated the description. Make your updates based on the required updates listed there. |
… new overload Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
UseStatusCodePagesWithReExecute
src/Middleware/Diagnostics/test/UnitTests/StatusCodeMiddlewareTest.cs
Outdated
Show resolved
Hide resolved
src/Middleware/Diagnostics/src/StatusCodePage/StatusCodePagesExtensions.cs
Show resolved
Hide resolved
src/Middleware/Diagnostics/src/StatusCodePage/StatusCodePagesExtensions.cs
Outdated
Show resolved
Hide resolved
My implementation already aligns with the updated description requirements. The changes include: ✅ Renamed Build and tests pass successfully. (b6bec12) |
Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
@halter73, removing optionality in the old method, following the guidelines of roslyn, requires a change to
|
Solved, @javiercn pointed me to aspnetcore/docs/APIBaselines.md Line 40 in a070501
|
This PR implements the approved API proposal to add support for creating DI scopes when re-executing requests in StatusCodePages middleware.
Changes Made
API Surface Changes
StatusCodePagesOptions:
CreateScopeForErrors
→CreateScopeForStatusCodePages
propertyfalse
to maintain existing behaviorStatusCodePagesExtensions:
UseStatusCodePagesWithReExecute(string, string?)
to remove default parameterUseStatusCodePagesWithReExecute(string, string? = null, bool createScopeForStatusCodePages = false)
Usage Examples
Implementation Details
CreateHandler
method to use the new property nameBenefits
This change allows error handling middleware to run in a fresh DI scope, which is important for scenarios where:
CreateScopeForErrors
functionality inExceptionHandler
The API follows the same pattern as
ExceptionHandlerOptions.CreateScopeForErrors
for consistency.Fixes #62408.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.