Wednesday, February 09, 2011

Simple Error Reporting on WP7

“It's not a bug - it's an undocumented feature “
Unfortunately, the sad fact is that we all make mistakes! How can we make our Windows Phone 7 Application send us error reports? Why not just email it to yourself?
Here is a simple code snippet to get you started:

private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
   if (System.Diagnostics.Debugger.IsAttached)
   {
       System.Diagnostics.Debugger.Break();
   }
   e.Handled = true;
   Microsoft.Phone.Tasks.EmailComposeTask task = new Microsoft.Phone.Tasks.EmailComposeTask();
   task.Body = e.Exception.Message;
   task.Subject = "Error Report";
   task.To = "support@myCoolWP7App.com";
   task.Show();
}

Read more: Rudi Grobler in the Cloud