dotnet / dotnet/aspnetcore

Blazor WebAssembly Hot Reload does not work if body tag is incorrect

Open
#38,454 3 comments 1 reaction 0 assignees View on GitHub
area-commandlinetools bug feature-hot-reload
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

Blazor WebAssembly Hot Reload does not work when the HTML body tag is not correct. This may not be a bug, but it threw no errors and was frustrating to debug.

This occurred when I was upgrading a project from .NET 5 to .NET 6.

When a change was made, the hot reload would detect that a file was changed.
`watch : File changed: C:\Users\trevo\...etc`
However, it would be stuck at never apply the updates to the UI.

My body tag in my index.html was configured incorrectly. It had an extra space at the end of the body tag.

```



EmptyBlazor6App



Loading...


An unhandled error has occurred.
Reload
🗙


```

``
Should have been:
``

This is more hopefully just an FYI as opposed to something that perhaps a direct bug.

### To Reproduce

1. Create a new Blazor WebAssembly project
2. Incorrectly configure your body tag on your index.html to have an extra space at the end.
3. Witness hot reload not work

### Further technical details
- .NET version: 6.0
- using dotnet watch

### Fixes/Workarounds
Make sure the tags don't have any extra space in them so that the Hot Reload Deltas can be correctly applied.

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.