How to resolve "An unhandled error has occurred. Reload 🗙" in Blazor application?

Hassan Raza Khan 20 Reputation points
2024-05-24T05:48:47.9466667+00:00

I am encountering this error consistently while executing my Blazor file. I reinstalled Visual Studio in case of missing files, but it did not work. I also tried creating Blazor files both from CLI and VS, but the error persists.

Screenshot 2024-05-24 103512

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,460 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,791 questions
{count} votes

Accepted answer
  1. JasonPan - MSFT 4,706 Reputation points Microsoft Vendor
    2024-05-24T11:00:48.07+00:00

    Hi @Hassan Raza Khan,

    After testing, the issue is related to the project name, you are using Sample Blazor App and issue occurs. If using SampleBlazorApp, it will works fine.

    Reason:

    In App.razor file, we can find it will use this line, then the url will be https://localhost:7298/Sample%20Blazor%20App.styles.css.

    If there are no special characters (spaces) when naming, you will not encounter this problem.

    <link rel="stylesheet" href="Sample Blazor App.styles.css" />
    

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,

    Jason

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful