-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Obsolete RazorRuntimeCompilation #62793
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR marks the Razor Runtime Compilation feature as obsolete by adding the [Obsolete]
attribute with diagnostic ID "ASPDEPR003" to public APIs and classes. The obsolescence message recommends using build-time compilation for production and Hot Reload for development scenarios.
Key changes:
- Added
[Obsolete]
attributes to public classes and extension methods in the Razor Runtime Compilation namespace - Added
#pragma warning disable/restore ASPDEPR003
directives around existing usage of now-obsolete types in test files and internal implementation code - Maintained backward compatibility while warning users about the deprecation
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
MvcRazorRuntimeCompilationOptions.cs | Added obsolete attribute to the main options class |
RazorRuntimeCompilationMvcCoreBuilderExtensions.cs | Marked extension methods as obsolete |
RazorRuntimeCompilationMvcBuilderExtensions.cs | Marked extension methods as obsolete |
AssemblyPartExtensions.cs | Marked extension methods as obsolete |
FileProviderRazorProjectItem.cs | Marked class as obsolete |
Various test files | Added pragma warnings to suppress obsolete warnings for existing test code |
Internal implementation files | Added pragma warnings around usage of obsolete types |
@@ -6,7 +6,9 @@ | |||
|
|||
namespace Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation; | |||
|
|||
#pragma warning disable ASPDEPR003 // Type or member is obsolete | |||
internal sealed class MvcRazorRuntimeCompilationOptionsSetup : IConfigureOptions<MvcRazorRuntimeCompilationOptions> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you thinking we'll suppress the warning and only remove these references once the types are removed?
Asking because I was looking at deprecating IActionContextAccessor and it's much easier if we don't remove our own use of the API during the obsoletion. It does mean we have to pay that cost later when we actually remove these types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This specific usage is an internal implementation detail of the feature we're deprecating. But I think the general idea is that we keep implementation and tests specific to the feature around and move anything that can be moved onto the new feature.
/ba-g aspnetcore-template-tests-pr test failure fixed on main |
Closes #62648