Handle error at non-UI thread

Posted by DreamTeam Mobile on Stack Overflow See other posts from Stack Overflow or by DreamTeam Mobile
Published on 2012-10-06T21:35:24Z Indexed on 2012/10/06 21:37 UTC
Read the original article Hit count: 177

Filed under:
|

For some reason unhandled exception which occur at non-UI thread don't handled by App_UnhandledException handler.

This approach works well for Windows Phone apps to globally handle, track and analyze exceptions but doesn't work for Windows 8 apps.

this.UnhandledException += App_UnhandledException; //doesn't handle

private void Button_Click_1(object sender, RoutedEventArgs e)

{
   var task = new Task(() => { throw new NullReferenceException("Test exc in UI thread"); });
   task.Start();
}

Please, advise.

© Stack Overflow or respective owner

Related posts about windows-8

Related posts about microsoft-metro