The Wayback Machine - https://web.archive.org/web/20211116215115/https://github.com/dotnet/aspnetcore/issues/38454
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
trevorcode opened this issue Nov 16, 2021 · 0 comments
Open

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

trevorcode opened this issue Nov 16, 2021 · 0 comments

Comments

Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
@trevorcode
Copy link

@trevorcode trevorcode commented Nov 16, 2021

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.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>EmptyBlazor6App</title>
    <base href="/" />
    <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
    <link href="css/app.css" rel="stylesheet" />
    <link href="EmptyBlazor6App.Client.styles.css" rel="stylesheet" />
</head>

<body>
    <div id="app">Loading...</div>

    <div id="blazor-error-ui">
        An unhandled error has occurred.
        <a href="" class="reload">Reload</a>
        <a class="dismiss">🗙</a>
    </div>
    <script src="_framework/blazor.webassembly.js"></script>
</body > <!--THE ISSUE IS RIGHT HERE-->

</html>

</body >
Should have been:
</body>

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment