Support Global Exception Handling Mechanism for .NET MAUI
See original GitHub issueDiscussed in https://github.com/dotnet/maui/discussions/653
<div type='discussions-op-text'>Originally posted by AmSmart April 5, 2021 With the new host model in .NET Maui, will we get a straightforward way of catching exceptions?</div>
Currently this is possible in WPF/WinForms via:
AppDomain.CurrentDomain.UnhandledException += (sender, error) =>
{
MessageBox.Show(text: error.ExceptionObject.ToString(), caption: "Error");
};
The ask of this issue is to enable AppDomain.CurrentDomain.UnhandledException for MAUI based applications to support a global exception handling mechanism.
I looked into the Windows MAUI WinUI3 end of things, and there appears to be a potential bug with the DispatcherQueue which prevents the application from being sent to the AppDomain.CurrentDomain.UnhandledException: https://github.com/microsoft/microsoft-ui-xaml/issues/5221
cc/ @hartez @mattleibow
Blazor Hybrid
Cross linking https://github.com/dotnet/aspnetcore/pull/40765 which handles the case of WPF/WinForms in Blazor Hybrid. If there’s a canonical way to do global exception handling (like we have in WinForms/WPF), we need to ensure .NET MAUI Blazor Hybrid is able to integrate with it directly.
Blazor Hybrid MAUI tracking issue: https://github.com/dotnet/maui/issues/4441
- https://github.com/dotnet/aspnetcore/pull/40765
- https://github.com/microsoft/microsoft-ui-xaml/issues/5221
- https://github.com/dotnet/maui/issues/4441
- MAUI: enable AppDomain.CurrentDomain.UnhandledException for MAUI based applications to support a global exception handling mechanism
Issue Analytics
- State:
- Created a year ago
- Reactions:23
- Comments:8 (1 by maintainers)
Top Related StackOverflow Question
Any update on this now that MAUI is so close to GA?
Ugh! Trying to port, having a hard time because I can’t see what’s going wrong here: