Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a Global Exception handler to a Metro Style App?

Is there any specific way to add a global exception handler to a Metro style app, just like LittleWatson in WP7 in the App.Xaml.cs file? what is the best practice and pattern to handle this?

like image 997
Jay Kannan Avatar asked May 25 '12 09:05

Jay Kannan


1 Answers

The UnhandledException event page explains why your exception is not handled by that (emphasis mine):

This event is only used with exceptions encountered by the XAML framework. Exceptions encountered by other Windows Runtime components or parts of the application that are not connected to the XAML framework will not result in this event being raised.

It goes on explaining that you should catch exceptions at the most specific time possible. As far as I know, there's no such thing as a global event handler in Windows 8 style apps.

like image 104
koenmetsu Avatar answered Sep 20 '22 20:09

koenmetsu