dotnet / dotnet/aspnetcore

[Hot Reload with dotnet watch] Blazor WASM Standalone hot reload reports changes applied but UI is not updated in .NET 11 Preview 6

Open
#67,611 10 comments 0 reactions 1 assignee Assigned to @javiercn View on GitHub
area-blazor feature-hot-reload
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

**Regression info**: Works well with .NET11 Preview 5

**Install Steps**
1. Clean machine: Win11 x64 ENU 25H2.
2. Install .Net 11.0 preview 6 SDK.
3. Add feed.

**Repro Steps**
1. Open a normal Command Prompt.
2. Create a Blazor WebAssembly Standalone project.
```
dotnet new blazorwasm -o MyBlazorWasmApp -f net11.0
```
3. Run the project with `dotnet watch --verbose`.
5. Open Pages/Home.razor with notepad and add a Counter component below.
```

```

**Note:**
1. This does not repro in .NET10/9/8.
2. This also repro with VS hot reload using http.

**Actual:**
Hot reload changes are not applied while the terminal will display C# and Razor changes are applied,

Image

**Expected**
Hot reload applies changes.
(screenshot from .NET11 Preview 5)
Image

dotnet watch --verbose logs

```text
dotnet watch ⌚ Working directory: 'C:\Users\v-ctamayo\MyBlazorWasmApp'
dotnet watch ⌚ Watching with Hot Reload.
dotnet watch πŸ”₯ Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
dotnet watch πŸ’‘ Press Ctrl+R to restart.
dotnet watch πŸ”¨ Restoring C:\Users\v-ctamayo\MyBlazorWasmApp\MyBlazorWasmApp.csproj ...
dotnet watch πŸš€ Launched 'C:\Program Files\dotnet\dotnet.exe' with arguments 'restore C:\Users\v-ctamayo\MyBlazorWasmApp\MyBlazorWasmApp.csproj --property:NuGetInteractive=true -consoleLoggerParameters:NoSummary': process id 12808
Restore complete (0.4s)

Build succeeded in 0.9s
dotnet watch ⌚ Process id 12808 ran for 1433ms and exited with exit code 0.
dotnet watch πŸ”¨ Project graph loaded in 0.6s.
dotnet watch πŸ”¨ Building C:\Users\v-ctamayo\MyBlazorWasmApp\MyBlazorWasmApp.csproj ...
dotnet watch πŸš€ Launched 'C:\Program Files\dotnet\dotnet.exe' with arguments 'build C:\Users\v-ctamayo\MyBlazorWasmApp\MyBlazorWasmApp.csproj --property:NuGetInteractive=true --framework net11.0 --no-restore': process id 24936
info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
MyBlazorWasmApp net11.0 browser-wasm succeeded (4.2s) β†’ bin\Debug\net11.0\wwwroot

Build succeeded in 4.8s
dotnet watch ⌚ Process id 24936 ran for 5316ms and exited with exit code 0.
dotnet watch ⌚ Loading projects ...
dotnet watch πŸ”¨ Design-time build completed in 0.6s.
dotnet watch ⌚ Loaded 1 project(s) in 0.6s.
dotnet watch πŸ”¨ Reading static web assets manifest file: 'C:\Users\v-ctamayo\MyBlazorWasmApp\obj\Debug\net11.0\staticwebassets.development.json'.
dotnet watch ⌚ Watching 281 file(s) for changes
dotnet watch ⌚ Exclusion glob: '**\node_modules\**;node_modules\**;**\jspm_packages\**;jspm_packages\**;**\bower_components\**;bower_components\**;**\packages.lock.json;bin\Debug\/**;obj\Debug\/**;bin\/**;obj\/**;bin\Debug\net11.0\browser-wasm\publish\/**;**/*.user;**/*.*proj;**/*.sln;**/*.slnx;**/*.vssscc;**/.DS_Store' under project 'C:\Users\v-ctamayo\MyBlazorWasmApp'
dotnet watch ⌚ Solution after project update: v1
dotnet watch πŸ”₯ Hot reload session started.
dotnet watch ⌚ Application kind: BlazorWebAssembly.
dotnet watch πŸ”ƒ [MyBlazorWasmApp (net11.0)] Using browser-refresh middleware
dotnet watch πŸ”ƒ [MyBlazorWasmApp (net11.0)] Refresh server running at ws://localhost:53035,wss://localhost:53036.
dotnet watch πŸ”₯ [MyBlazorWasmApp (net11.0)] Project specifies capabilities: Baseline, AddMethodToExistingType, AddStaticFieldToExistingType, NewTypeDefinition, ChangeCustomAttributes, AddInstanceFieldToExistingType, GenericAddMethodToExistingType, GenericUpdateMethod, UpdateParameters, GenericAddFieldToExistingType, AddExplicitInterfaceImplementation.
dotnet watch ⌚ Configured to launch a browser on ASP.NET Core application startup.
dotnet watch πŸš€ [MyBlazorWasmApp (net11.0)] Launched 'C:\Program Files\dotnet\dotnet.exe' with arguments 'run --no-build --framework net11.0 -e DOTNET_WATCH=1 -e DOTNET_WATCH_ITERATION=1 -e ASPNETCORE_AUTO_RELOAD_WS_ENDPOINT=ws://localhost:53035,wss://localhost:53036 -e ASPNETCORE_AUTO_RELOAD_WS_KEY=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr5j99C+i1kSkPbIix4a8UxvNbAI1F7SQxee3U2K+fOKj1Cc40gRbOIT9x/Aj1ItEQhusT6D7eQykcO1rR12Puz8Z2qcFlvCVFsEPy6EYkDR/+FoD3FGt9wxAUbgyMvpjMItJm+QOor1MlJOWclLPJ/YezdX9i3TpXY4rHCDgutqaJ2OIwAfa7H7PuarKGU9AkfMlo4qbe7F19ueFhvf+kVTyVcUhnTwBOBwQ1UtESKzJIRvp57+x7VuSo5VGdPO7nKbBPmORmhdm2dFKBqpWjeLaiJSDeEY6hCZpQMpcQuvKdD4hZMIHuOG9INsFPyKKHBI+PuzWpXj6aE8Aee7vkQIDAQAB -e ASPNETCORE_AUTO_RELOAD_VDIR=/ -e "DOTNET_STARTUP_HOOKS=C:\Program Files\dotnet\sdk\11.0.100-preview.6.26351.113\DotnetTools\dotnet-watch\11.0.100-preview.6.26351.113\tools\net11.0\any\hotreload\net6.0\Microsoft.AspNetCore.Watch.BrowserRefresh.dll" -e ASPNETCORE_HOSTINGSTARTUPASSEMBLIES=Microsoft.AspNetCore.Watch.BrowserRefresh -e DOTNET_MODIFIABLE_ASSEMBLIES=debug': process id 7640
dotnet watch ⌚ Waiting for changes
Using launch settings from C:\Users\v-ctamayo\MyBlazorWasmApp\Properties\launchSettings.json...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5103
dotnet watch ⌚ Launching browser: http://localhost:5103
dotnet watch πŸš€ Launched 'http://localhost:5103' with arguments '': process id 22080
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\Users\v-ctamayo\MyBlazorWasmApp
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
Failed to determine the https port for redirect.
dotnet watch ⌚ File change: Update 'C:\Users\v-ctamayo\MyBlazorWasmApp\Pages\Home.razor'.
dotnet watch ⌚ File change: Update 'C:\Users\v-ctamayo\MyBlazorWasmApp\Pages\Home.razor'.
dotnet watch ⌚ File updated: .\Pages\Home.razor
dotnet watch ⌚ Updating document text of 'C:\Users\v-ctamayo\MyBlazorWasmApp\Pages\Home.razor'.
dotnet watch ⌚ Solution after document update: v2
dotnet watch πŸ”₯ Hot reload capabilities: AddExplicitInterfaceImplementation AddInstanceFieldToExistingType AddMethodToExistingType AddStaticFieldToExistingType Baseline ChangeCustomAttributes GenericAddFieldToExistingType GenericAddMethodToExistingType GenericUpdateMethod NewTypeDefinition UpdateParameters.
dotnet watch πŸ”ƒ [MyBlazorWasmApp (net11.0)] Updating diagnostics.
dotnet watch πŸ”ƒ [MyBlazorWasmApp (net11.0)] No browser is connected.
dotnet watch πŸ”₯ [MyBlazorWasmApp (net11.0)] Sending update batch #0
dotnet watch πŸ”ƒ [MyBlazorWasmApp (net11.0)] No browser is connected.
dotnet watch πŸ”₯ C# and Razor changes applied in 769ms.
``

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.