Create crash dump file in Windows Phone

Your app got crash ?

This is very handy snippet for you :

this.UnhandledException+=App_UnhandledException;
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
 if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
 System.Diagnostics.Debugger.Break();
}
else
{
 System.IO.IsolatedStorage.IsolatedStorageFile f = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication();
 using(StreamWriter w = new StreamWriter(f.OpenFile("crashLog.txt",FileMode.Create)))
  {
   w.Write(e.ToString());
  }
 }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s