Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Blazor webview] Exception handling for blazor webview #4441

Closed
Tracked by #5535
javiercn opened this issue Feb 1, 2022 · 3 comments
Closed
Tracked by #5535

[Blazor webview] Exception handling for blazor webview #4441

javiercn opened this issue Feb 1, 2022 · 3 comments
Assignees
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView feature-blazor-windesktop Issues in Blazor in WPF or WinForms
Milestone

Comments

@javiercn
Copy link
Member

javiercn commented Feb 1, 2022

We have several issues that touch different aspects of the same area:

#3695
#2057
#2598

Since these aspects are deeply related, this issue supersedes the other mentioned issues and provides some details on the expected behaviors:

  • Unhandled exceptions on a Blazor Webview should be treated in the same way as unhandled exceptions in other platforms.
    • Raising up to the "AppDomain" "UnhandledException" event in Winforms and WPF before terminating the application.
    • Using the same mechanism Maui offers for dealing unhandled exceptions.
  • We should consider a "standard" way to display errors across platforms to aid in development scenarios. One option here is to use the Details and Summary html elements to provide additional details during development. This would follow the same pattern we use in other platforms via the DETAILEDERRORS config value.

General expectations around exception types:

  • Un-awaited task throws:
    • These should unwind the stack and be handled at the platform level. Blazor doesn't have any insight into these exceptions and can't react to them.
  • Render exception:
    • These flow up to Renderer.HandleException where they need to get rethrown for the general exception handling mechanism from the platform to kick in.
  • Event handler exception: These are handled by Blazor in the same way across different platforms and already flow to Renderer.HandleException
  • JSInterop exceptions: These should unwind the stack and be handled at the platform level.
  • Exceptions while bootstrapping the Blazor Webview: These should unwind the stack and be handled at the platform level, for example, DI exceptions when failing to resolve a service.
  • Caught exceptions within component code:
    • These are only visible through capturing first-chance exceptions in the debugger as Blazor doesn't get visibility into them (they are caught).
    • Our own components shouldn't contain any of these types of exceptions, however in general, these exceptions are not "flavor" specific and also affect Webassembly and desktop.
@TanayParikh
Copy link
Contributor

Support has been added for WPF/WinForms and needs to be consumed by dotnet/maui, by consuming aspnetcore 6.0.4 packages.

For dotnet/MAUI there isn't a global exception management capability. I've created #5535 to track adding support for this.

@TanayParikh TanayParikh added the blocked Work that is currently blocked label Mar 23, 2022
@TanayParikh TanayParikh modified the milestones: 6.0.300-rc.2, 6.0.300-rc.3 Apr 7, 2022
@TanayParikh
Copy link
Contributor

Pushing to RC3 as we're awaiting release of the 6.0.4 SDK which has the dotnet/aspnetcore#40765 fix.

@TanayParikh
Copy link
Contributor

This is now working in maui main for WPF/WinForms. Closing this issue out, further efforts for first class MAUI support will be tracked via #5535.

@TanayParikh TanayParikh added feature-blazor-windesktop Issues in Blazor in WPF or WinForms and removed blocked Work that is currently blocked labels Apr 15, 2022
@ghost ghost locked as resolved and limited conversation to collaborators May 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView feature-blazor-windesktop Issues in Blazor in WPF or WinForms
Projects
None yet
Development

No branches or pull requests

3 participants