3

In WinForms, we used the following in Main() or some other startup event:

System.Windows.Forms.Application.ThreadException += ExceptionHandler.Handle;

I searched for something similar in WinUI3 (Windows App SDK) and cannot seem to find anything.

Is there a globalized way of throwing up an exception notification for WinUI3?

1

1 Answer 1

4
public App()
{
    InitializeComponent();
    UnhandledException += App_UnhandledException;
}

private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
    // Handle the exception here.
}

According to some issues posted on the GitHub repo, for example this one, it doesn't catch all exceptions though.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.