AvaloniaUI/Avalonia

Dispatcher.UIThread.UnhandledException not triggering on MacOS

Whiletru3 opened this issue · 1 comments

Describe the bug

Hello,
I Implement this feature to handle the unhandled exception Dispatcher.UIThread.UnhandledException.
On Windows, the exception is handled and everything is fine.
Using the same code on MacOS, the exception is not handled so the app main loop exit

The feature is explained in this PR : #14432

To Reproduce

in the App.Initialize(), use the Dispatcher.UIThread.UnhandledException. And throw an exception in a viewmodel

Expected behavior

The event should be triggered in MacOS

Avalonia version

11.1.3

OS

macOS

Additional context

This feature is missing in the documentation https://docs.avaloniaui.net/docs/concepts/unhandledexceptions

Do you have minimal repro, where your exception is raised exactly?
UnhandledException has a quite limited scope of what it can intercept, by design. And it's generally not recommended to rely on.
In short, it only catches exceptions that go through dispatcher, and couldn't be handled by other means. Pretty much the same behavior as in WPF, but they might pass more logic through dispatcher.