Getting error An unhandled exception has occurred. See browser dev tools for details. Reload 🗙

11,487

Solution 1

Actually I had the same problem but the solution is with site.css it's contain some lines you need to add it to your css file

#blazor-error-ui{
 background: lightyellow;
 bottom: 0;
 box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
 display: none;
 left: 0;
 padding: 0.6rem 1.25rem 0.7rem 1.25rem;
 position: fixed;
 width: 100%;
 z-index: 1000;}
#blazor-error-ui .dismiss {
 cursor: pointer;
 position: absolute;
 right: 0.75rem;
 top: 0.5rem;}

Solution 2

it's not an exception but by removing or not including the css/site.css file you removed the styles that hide the error message div.

The #blazor-error-ui defaults to display: none so by not including or removing it, you're simply just showing the div.

If you include the #blazor-error-ui and #blazor-error-ui .dismiss sections, you should be fine, if you didn't want to include the css/site.css file that was generated with your project. You mentioned you deleted it, here is what mine looks like for a new default project:

@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #0366d6;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

Best of luck!

Share:
11,487
Arun Singh
Author by

Arun Singh

Updated on June 08, 2022

Comments

  • Arun Singh
    Arun Singh almost 2 years

    Hi I am working on Blazor server side and getting "An unhandled exception has occurred. See browser dev tools for details. Reload 🗙" message. i tried to see the console but nothing is there. Attached screen of console.

    enter image description here

  • ProgrammerBret
    ProgrammerBret over 3 years
    For me clearing cache worked, as I have been making many minor changes which produced this error
  • ProgrammerBret
    ProgrammerBret about 3 years
    At first clearing cache solved this, but when I added these lines this seems to have fixed it.
  • daddycardona
    daddycardona over 2 years
    Thank you so much. I did delete this and I also added it back to app.css since I am only using wasm :)