Skip to content

Mark all AddRazorRuntimeCompilation extension methods and related APIs as obsolete for consistent Razor runtime compilation deprecation in .NET 10 #64372

@joperezr

Description

@joperezr

Background and Motivation

As raised in dotnet/aspnetcore#64338: Razor runtime compilation is being fully deprecated in .NET 10 with the intent to remove it in a future release. While some extension methods currently show the obsolete warning, others (e.g., AddRazorRuntimeCompilation with no arguments) do not, leading to confusion for end users.

Bug Details

  • Only some overloads (those taking Action) display an obsolete warning due to the argument type being obsolete.
  • Parameterless method overloads for AddRazorRuntimeCompilation do NOT display any warning.
  • API users can unknowingly continue using obsolete runtime compilation APIs with no warning.

Solution Proposal

  • Mark ALL overloads of AddRazorRuntimeCompilation and related extension methods with the ASPDEPR003 [Obsolete] attribute (not just on the parameter type or static class).
  • Ensure every use of AddRazorRuntimeCompilation (parameterless or otherwise) triggers the intended obsolete warning in .NET 10 and future releases.
  • Reference obsolete warning to Hot Reload as the recommended alternative for development workflows.

Code references

Relevant source files needing updates:

Example usage

mvcBuilder.AddRazorRuntimeCompilation(); // Should generate ASPDEPR003 obsolete warning
mvcBuilder.AddRazorRuntimeCompilation(options => {}); // Should generate ASPDEPR003 obsolete warning

Risks

  • Breaking change for developers using runtime compilation extension APIs for development
  • Required migration pain for scenarios relying on runtime view loading (e.g. from a database, custom provider, or dynamic sources)

Related context

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templates

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions