Skip to content

[Hot Reload with dotnet watch] Create a Blazor Web App project, update the .css file, the browser updates the display colors, then refresh the browser, and the project will revert to its previous state #65177

@EmilyFeng97

Description

@EmilyFeng97

REGRESSION INFO Works well on 10.0/9.0/8.0 and previous build 11.0.100-alpha.1.26060.102

INSTALL STEPS

  1. Clean Win11 x64 23h2 ENU
  2. Install the .NET 11.0 preview 1 SDK: https://aka.ms/dotnet/11.0.1xx/daily/dotnet-sdk-win-x64.exe
  3. Add feed: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet11/nuget/v3/index.json

Platform

  • Windows
  • macOS
  • Linux

Repro Steps

  1. Open a normal Command Prompt
  2. Create a Blazor Web App for Server project, and run it using dotnet watch
    dotnet new blazor -int Server -o MyBlazorServerApp
    cd MyBlazorServerApp
    dotnet watch
    
  3. Open Components/Layout/MainLayout.razor.css in Notepad, update the .page selector:
    .page {
        position: relative;
        display: flex;
        flex-direction: column;
    +   background-color: orange;
    
  4. Save the change, the browser update to display the color
  5. Refresh the browser, view the browser

Actual Result
The page will return to the previous state after refresh the browser.

Image

Note:

  1. This issue does not repro on 10.0/9.0/8.0 project.
  2. This issue does not repro Blazor WebAssembly Standalone project.
  3. This issue also repro on Blazor web app for Wasm project.
  4. The issue does not repro when hot reload in vs 18.4I1.
  5. This issue also repro on wwwroot/app.css file, does not repro on .razor file.

Error Log

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor Componentsfeature-hot-reloadThis issue is related to the Hot Reload feaatureinvestigate

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions