[Blazor] Hot Reload not working properly when applying rendermode InteractiveServer to razor page in .NET 8.0.100
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
Hotreload not working when applying rendermode InteractiveServer to razor page in .NET 8.0.100
### Expected Behavior
_Do you want to restart your app - Yes (y) / No (n) / Always (a) / Never (v)?_ message in terminal or working hotreload.
### Steps To Reproduce
1. Create new project with `dotnet new blazor`
2. Create new file **Test.razor** in Pages:
```
@page "/test"
@rendermode InteractiveServer
@inject IJSRuntime JSRuntime
Test
Test
HelloMessage
@code {
private async Task HelloMessage()
{
string text = new(await JSRuntime.InvokeAsync("alert", 123));
}
}
```
3. Run with `dotnet watch`
4. Try to click button. Gives js alert "123" as expected
5. Remove line `@rendermode InteractiveServer` and save
6. In terminal answer **Y** to _Do you want to restart your app - Yes (y) / No (n) / Always (a) / Never (v)?_
7. Try to click button. Nothing happens as expected
8. Restore line `@rendermode InteractiveServer` and save. This initiates message _File changed: .\Components\Pages\Test.razor. Hot reload of changes succeeded._ in terminal
9. Try button. Nothing happens. Expected: js alert "123". You may also try browser refresh F5, does not fix the problem.
Only fix is to stop and then run again with `dotnet watch`
### Exceptions (if any)
_No response_
### .NET Version
8.0.100
### Anything else?
_No response_
Contributor guide
Research direction
Reproduce the behavior using a new `dotnet new blazor` project, `Test.razor`, and `dotnet watch`, following the listed render-mode changes and button checks. Start by tracing the hot reload handling for Razor pages and InteractiveServer changes; done means restoring `@rendermode InteractiveServer` after a reload leaves the button working without restarting the app.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, javascript
- Domain
- developer-experience, frontend, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100