Build faster, error-free Universal Windows Platform (UWP) apps with Raygun

| 4 min. (688 words)

With 900 million devices running on Windows 10, the future is bright for the Universal Windows Platform (UWP).

UWP’s strength lies in its ability to adapt itself completely to the native user interface - whether that’s a computer, tablet, Xbox or IoT device. It’s a win-win; users get a consistent experience as they consume across devices, while developers get easier deployments.

While UWP is great for building consistent experiences across platforms, performance problems, crashes, and errors will still affect end-users unless you have application performance monitoring in place.

Raygun is committed to helping developers provide excellent software experiences that are fast and error-free. That’s why today, we’re excited to announce UWP support for Crash Reporting and Real User Monitoring.

With this new provider, you’ll gain visibility into problems affecting end-users of your UWP apps, with detailed stack traces, advanced filtering, deployment tracking, user tracking, and more.

How to get started with the UWP provider

First of all, you’ll need a Raygun account. If you aren’t already a Raygun customer, create an account and follow the installation instructions.

Here’s how to get started with Crash Reporting.

1. Install the NuGet package

Raygun4UWP is available as a NuGet package.

Using your IDE of choice, or the package manager console, install the Raygun4UWP NuGet package into your project. More information about the NuGet package can be found here.

2. Initialize the RaygunClient and enable unhandled exception tracking

The most basic setup of Raygun4UWP can be achieved with a single line of code. Place the following code within the App.xaml.cs constructor. Your app API key is displayed on the instructions page, whenever you create a new application in Raygun. You can also find the API key by clicking the “Application Settings” button in the side menu of the Raygun app.

RaygunClient.Initialize("YOUR_APP_API_KEY").EnableCrashReporting();

3. Upload your PDB files

In order to get line numbers and file names in your crash report stack traces, you can upload your application’s PDB file to Raygun. There are a couple of different ways to do this, which are outlined in the Upload your PDB files section.

It’s that easy to get set up. Raygun will start monitoring your UWP apps for crashes, errors, and performance problems in minutes.

Build faster, more performant UWP apps

Crashes are only part of the story - users also expect your app to be fast and responsive. When used alongside Crash Reporting, Real User Monitoring surfaces issues in a fraction of the time. RUM answers questions like:

  • What is my P99 load time?
  • Which page path did this user take to encounter this error?
  • Is the latest version of the app faster for all users?

Screenshot of Raygun Real User Monitoring

Here’s how to get set up with RUM

1. Install the NuGet package

Raygun4UWP is available as a NuGet package. Using your IDE of choice, or the package manager console, install the Raygun4UWP NuGet package into your project. More information about the NuGet package can be found here.

2. Initialize the RaygunClient and enable Real User Monitoring

The most basic setup of Raygun4UWP can be achieved with a single line of code. Place the following code within the App.xaml.cs constructor. Your app API key is displayed on the instructions page whenever you create a new application in Raygun. You can also find the API key by clicking the “Application Settings” button in the side menu of the Raygun app.

RaygunClient.Initialize("YOUR_APP_API_KEY").EnableRealUserMonitoring();

3. Wire up navigation events

Navigation in a UWP application can be implemented in many different ways and there are no global navigation events to hook into. Because of this, Raygun4UWP won’t be able to automatically send page-view events to Raygun with the above setup alone. Instead, Raygun4UWP provides two mechanisms for sending navigation events to Raygun - the ListenToNavigation attached property and the ability to manually send events which are both explained in the documentation.

For more on UWP performance, Microsoft has a useful guide.