Since I started working on my first Windows Phone app I’ve always used the Little Watson class developed by Andy Penell. The original version is available here.

It’s so useful, especially when you’re running an app on your device, and suddenly that “now and again” issue happens in the coffee shop or wherever.

If you’ve not used it before, it records exception information when your app raises an unhandled exception or the navigation fails just before it shuts down. The next time you start the app it checks to see if there’s any error information available and if there is then it shows a dialog to the user asking if they want to send it to you. Simple UI, doesn’t get in the way, super helpful.

So now I’m re-writing my old WP8 code to make it a Universal App, Little Watson was a must have…..but I want to share it.

The code has had to be changed to work with the Async methods, and Universal Apps now use

ApplicationData.Current.LocalFolder

(or LocalFodder if my fingers get their way) to access the local IO, but the original code was really straight forward so migrating it wasn’t an issue at all.

Once you’ve added it to the project and altered the required fields (email address!) you wire it up inside the shared App.xaml.cs file

async void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
    await LittleWatson.ReportException(e.Exception, e.Message);
 }

(yes, I know async void is bad – but events are the exception remember) wire this method up to UnhandledException, and do the same for NavigationFailed and you’re away!

Download: SharedLittleWatson.zip