In developing apps for Windows Phone, I’ve been using the Northern Lights code library which includes Little Watson; a library for packaging exceptions and sending them to a http listener. The demo application uses a php page to send an email. Scott Hanselman’s inaugural WP7 post has him doing the same thing with an EmailComposeTask. Deep down, I’m a numbers nerd though, so culling through email to determine trends and statistics isn’t going to work for me. So I’ve created a ASP.NET webform that writes to a database. Not a huge deal, but when combined with ASP.NET dynamic data, I’ve got a live bug collection system that I can cull and extend as my needs grow more elaborate. I’ve setup three applications using this approach now, and it’s working pretty well for me.
To get this working for you, you’ll need to
- Create a new Dynamic Data website (or add dynamic data features to an existing website).
- Create a WatsonException entity that has the properties of the ExceptionContainer. I’m using Message, StackTrace, App Name, App Version, ExceptionRecordedDateTime.
- Create a webpage that LittleWatson can send an HTTP post to. All of the exception data will be encoded in a variable called Exception. The Application Name is not included in the post, so I am creating a separate listener for each application.
- In the webpage, save the exception data to the WatsonException context.
For me, this was another situation where a dynamic data website let me quickly deal with the incoming data on my terms, not letting this exception data clog my inbox. This also has the added benefit of requiring no user interaction, which makes it more likely that these reports will be submitted. If you choose to go down this route, there are two other items I would encourage you to remember.
The library uses a network connection to send the error reports (obviously). This means that your app needs to have the ID_CAP_NETWORKING or your error code won’t work. Just add it now, to save yourself the drama.