private void OnUnhandledException(object sender, Exceptions.UnhandledExceptionEventArgs args) { InvokeAsync(async() => { Exception exceptionThrownInHandler = null; try { await UnhandledException.InvokeAsync(args).ConfigureAwait(false); } catch (Exception e) { exceptionThrownInHandler = e; } if (exceptionThrownInHandler != null || !args.WasHandled) { ExceptionToThrow = exceptionThrownInHandler ?? args.Exception; StateHasChanged(); } }); }