Skip to content

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

Merged
merged 1 commit into from
Jul 18, 2025
Merged

Conversation

BrennanConroy
Copy link
Member

Closes #62648

@Copilot Copilot AI review requested due to automatic review settings July 17, 2025 23:27
@BrennanConroy BrennanConroy requested a review from a team as a code owner July 17, 2025 23:27
Copy link
Contributor

@Copilot Copilot AI left a 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

@github-actions github-actions bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Jul 17, 2025
@@ -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>
Copy link
Member

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.

Copy link
Member Author

@BrennanConroy BrennanConroy Jul 18, 2025

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.

@BrennanConroy
Copy link
Member Author

/ba-g aspnetcore-template-tests-pr test failure fixed on main

@BrennanConroy BrennanConroy merged commit 223fe49 into main Jul 18, 2025
30 of 31 checks passed
@BrennanConroy BrennanConroy deleted the brecon/razorcompilation branch July 18, 2025 17:59
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-preview7 milestone Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Obsolete Razor Runtime Compilation (Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation)
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy