-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Deprecate IActionContextAccessor #62647
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! |
…gs in framework code Co-authored-by: captainsafia <[email protected]>
…ated IActionContextAccessor Co-authored-by: captainsafia <[email protected]>
@copilot Replace IActionContextAccessor with IHttpContextAccessor wherever it is currently used in the codebase. |
…he codebase Co-authored-by: captainsafia <[email protected]>
Done! I've successfully replaced
The framework now uses the modern endpoint routing approach consistently. Commit: 843dfd3 |
@copilot Add back the obsolete attribute on the interface and concrete implementations, even if the framework is not using it. |
…ActionContextAccessor class Co-authored-by: captainsafia <[email protected]>
Done! I've added back the obsolete attributes to both the IActionContextAccessor interface and ActionContextAccessor class. The attributes include the guidance message directing developers to use IHttpContextAccessor instead. Commit: e2c25f0 |
With the introduction of endpoint routing,
IActionContextAccessor
is no longer necessary as developers can access action descriptor and metadata information directly throughHttpContext.GetEndpoint()
. This change deprecates both the interface and its implementation to guide developers toward the modern approach.Changes Made
Added Obsolete Attributes
[Obsolete]
attribute toIActionContextAccessor
interface with guidance message[Obsolete]
attribute toActionContextAccessor
class with same guidance messageMaintained Backward Compatibility
#pragma warning disable CS0618
around all internal framework usage to suppress warningsMigration Path
Developers should migrate from:
To:
Impact
This deprecation aligns with ASP.NET Core's architectural evolution toward endpoint routing and provides a cleaner, more direct way to access endpoint metadata.
Fixes #28162.
💡 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.