Bert
Bert

Reputation: 127

MAUI blazor an unhandled error has occurred

If there is an error in the program, I get "An unhandled error has occured". With Blazor Web assembly I can open the developper tools in the browser to get the details of what happend. This is not possible in Blazor MAUI.

So how can I get the details of the error in Blazor MAUI?

Upvotes: 8

Views: 9285

Answers (3)

Terrence
Terrence

Reputation: 341

When you get this type of error:

Pic of Error

First click the screen with your mouse, then hit F12. Then select the Console link a top of Dev Tools Form.

Dev Tools Pic

Upvotes: 8

Ewerton
Ewerton

Reputation: 4533

There is a way to "remotely inspect" your app using the browser developer tool (F12). First, check if you added the AddBlazorWebViewDeveloperTools in your MauiProgram.cs

#if DEBUG
    builder.Services.AddBlazorWebViewDeveloperTools();
#endif

Run your App and open a new tab in your browser (outside the emulator) and type:

  • For Chrome: chrome://inspect
  • For Edge: edge://inspect

Wait a little and you will see an "inspect" button like below: enter image description here

And you can even navigate in your App from there: enter image description here

Upvotes: 20

Cody
Cody

Reputation: 8954

You can open the developer tools by pressing ctrl + shift + i (or cmd + shift + i for Mac) when you have focus inside the web view.

Note: you need to enable the developer tools.

builder.Services.AddMauiBlazorWebView();

// enable the developer tools
builder.Services.AddBlazorWebViewDeveloperTools();
builder.Services.AddBlazorWebView();

Upvotes: 4

Related Questions