Repository navigation
Obsolete RazorRuntimeCompilation - #62793
Conversation
There was a problem hiding this comment.
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 ASPDEPR003directives 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 |
| 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.
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.
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 |
|
Breaking change announcement; aspnet/Announcements#522 |
Closes #62648