How to deal with the “Unspecified error” in a Windows Phone application

While developing and testing a Windows Phone application you may have to deal with a really annoying problem: your application crashes and the only error reported by Visual Studio is a generic Unspecified error.

Visual Studio itself isn’t of any help, because the error is intercepted by the global error handler available in the App.xaml.cs file, so you don’t have a way to understand where exactly the problem occured.

The solution is easy to understand, even if it’s not easy to find: this error is raised usually when your XAML contains a property with an invalid value. For example, when I had to deal with this error I found that, by mistake, the Margin property of a control contained the value 0k, 0, 0, 15, that is obviously not correct (the margin property accepts only numeric values).

To help understanding where your application may contain such an error, keep track of the the time when Visual Studio intercept the “Unspecified error” exception: usually, this error is raised only when you navigate towards a page that has this problem.

Good debugging!

This entry was posted in Windows Phone and tagged . Bookmark the permalink.

One Response to How to deal with the “Unspecified error” in a Windows Phone application

  1. Haha, I just actually ran into this problem a few days ago. I entered R as my top margin to a button when I ment 5..
    Stupid mistake took me around an hour to notice and fix.

Leave a Reply