Awesome Error handling for Windows Phone apps

JamieWeb DevelopmentLeave a Comment

windows-phone-8

Error handling for Windows Phone apps couldn’t be easier! Using the Raygun4Net NuGet package, you can set up your Windows Phone application to report all unhandled exceptions (and even handled ones if you like) to Raygun, where you can learn what exceptions are causing your application to crash.

Adding Raygun to your Windows Phone App

The first thing you need to do is install the Mindscape.Raygun4Net package. You can do this through the NuGet Package Explorer, or through the Package Manager Console by running Install-Package Mindscape.Raygun4Net.

Once this is installed, you need to attach the RaygunClient to your Application. This is easy – just add this code to your App’s constructor

You will need your Raygun Application’s API Key for this – you can find it in the Application Settings in Raygun.

This will set up Raygun to catch all unhandled exceptions. I told you it was easy! But wait, there’s more!

If your app knows who is logged in, you can attach that user’s information to the exception reported to Raygun. Maybe all of your crashes are coming from one user with bad hardware, or a low end phone. Raygun’s User Tracking feature lets you see this information alongside the exception.

When you know what user is using your app, simply set the UserInfo property on the RaygunClient.Current object with as much information as you have.

If you are building for Windows Phone 8.1, note that AdvertisingId might be empty if the user has turned off the AdvertisingId that property will be empty. That makes it a poor candidate for the Identifier (the RaygunIdentifierMessage constructor parameter is a unique identifier for the user).

If you are building for Windows Phone 8, the PublisherHostId is a unique id per device. If the user wipes their phone and sells it, this Id will stay the same so again it is not a good candidate for the Identifier. Also note that you need the ID_CAP_IDENTITY_DEVICE Capability selected in your WMAppManifest.

Grab your Raygun trial

Want awesome error handling for Windows Phone? Dive in and hook up Raygun in your Windows Phone apps now! If you need a Raygun account, as always there’s the free trial available here.

We would absolutely recommend Raygun to any business which relies on healthy software to serve there customers. Andrew Schofield, Chief technology officer at Timely. Take a free 14 day trial. Request a short demo of Raygun.

Leave a Reply

Your email address will not be published. Required fields are marked *