dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.15k stars 9.92k forks source link

Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation bug with AddRazorRuntimeCompilation() to an ASP.NET Core Web App (MVC) project #40066

Open RobertoFalconi opened 2 years ago

RobertoFalconi commented 2 years ago

Is there an existing issue for this?

Describe the bug

I made a brand new .NET 6 project with VS22, I added Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation package (version 6.0.1) from NuGet to the project, then I have added in the Program.cs:

var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();

and the result is that Bootstrap' layout "crashes": the footer is no more fixed to the bottom of the page, the header doesn't have the shadow anymore and so on. It follows a screenshot of the crashed page:

Cattura 2

Expected Behavior

This is what the page should look like instead:

Cattura

Steps To Reproduce

Just make a brand new ASP.NET Core Web App (MVC) with .NET 6, with both HTTPS and Docker support:

Cattura3

We now have this:

Cattura

Then install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation package (version 6.0.1) from NuGet to the project:

Cattura4

Finally the command AddRazorRuntimeCompilation();

Cattura5

And the result will be:

Cattura 2

Exceptions (if any)

No response

.NET Version

.NET 6.0

Anything else?

ASP.NET Core 6 Visual Studio Professional 2022

Ask me for anything

mkArtakMSFT commented 2 years ago

Thanks for contacting us. This is because Runtime Compilation doesn't support Scoped CSS.

mkArtakMSFT commented 2 years ago

Reopening this and moving to backlog

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.