For those who don’t know, Raygun is an exception tracking service that lets you monitor any unhandled exceptions being raised in your applications. Raygun supports a wide range of languages and frameworks such as .Net, Java, PHP and many more. Today we are pleased to announce that we have extended the .Net Raygun provider to support both Windows Phone 7.1 and 8.0. With Raygun integrated into your Windows Phone applications, you’ll get instant notifications of any unhandled exceptions. By logging into your Raygun dashboard you can see lots of information about each exception including the stack trace, the time it occurred, the locale and the orientation of the device. Exceptions are grouped together so they are easy to view, and trends show you the overall health of your application.
By using Raygun you can find out about application crashes before your customers even mention them. This lets you debug, resolve and send out an update for your apps as fast as possible.
Every now and then, an unhandled exception may occur in your application while a users phone is not connected to the internet. With this in mind you’ll be happy to hear that the Windows Phone Raygun provider is smart enough to handle this scenario. Instead of trying to send the Exception message to Raygun, messages will temporarily be stored in the applications isolated storage so that they can be sent later when the device is connected to the internet. This helps preventing you from missing out on any exceptions.
How to use Raygun
Getting started with Raygun takes a measly 5 minutes.
To integrate Raygun into your Windows Phone applications, start by creating a Raygun account if you haven’t done so already. You can sign up here. When you’re all signed up and logged in, create a new application, give it a name and choose your email notification options. Don’t worry, the email notifications won’t spam your inbox with every single exception instance. You’ll only get emails for the first time a particular type of exception occurs, or if the trend of an exception changes.
The next step is to install the Window Phone Raygun provider into your application. The easiest way to do this is through NuGet. Make sure you have the NuGet 2.1 or above add-in installed in Visual Studio, and also enable the “Allow NuGet to download missing packages during build” option.
Next, right click on your application and select “Manage NuGet Packages”. Search for Raygun and install the Mindscape.Raygun4Net package.
Now go to App.xaml.cs and add this static field:
private static readonly RaygunClient _client = new RaygunClient("YOUR_APP_API_KEY");
Where it says “YOUR_APP_API_KEY”, replace this with the api key for your application. You can get this by going to your dashboard at raygun.com and clicking on “Application Settings” in the panel on the left.
Last of all, go to the Application_UnhandledException method in App.xaml.cs and simply use the Raygun client to send the event args as seen here:
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
And that’s all there is to getting started with Raygun for Window Phone. You’ll notice the Raygun client has many method overrides to send handled exceptions, tags and custom data. This makes it flexible for you to add extra information that you find helps to debug your application.
Stay ahead of your competitors with bug-free Windows Phone applications with the help of Raygun. Sign up for the free trial now.