Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Catch ALL unhandled exceptions in Blazor MAUI Hybrid

$
0
0

Our problem is our production app is crashing and we don't know why. I need to be able to catch these errors in order to send crash analytics but the exceptions in question are sneaking through all error catching logic.

I have error catching logic using an ErrorBoundary component wrapping the entire application. This catches most exceptions however some exceptions still sneak through not triggering any error handling logic and showing the default error: enter image description here

Digging around I've found one exception is being thrown from a components DisposeAsync method. To reproduce, create a component that implements IAsyncDisposable like so:

@implements IAsyncDisposable@code {    public async ValueTask DisposeAsync()    {        throw new ApplicationException("How can I catch this?");    }}

I have tried the solutions in Show details of uncaught exception in Blazor UI and Is there a way to globally catch all unhandled errors in a Blazor single page application? including both the ErrorBoundary and ILogger approaches but neither catches this error. Those questions are also for Blazor WASM not Blazor Hybrid so there could be some differences.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>