Build together, debug together. Join the community on Discord.→

Uno Platform Error & Performance Monitoring with Raygun

Crash reporting is crucial for mobile and desktop app development. It keeps you in the loop about any exceptions, whether unhandled or caught. With Visual Studio App Center retiring soon, what’s the next best diagnostic tool?

While Microsoft suggests some alternatives, let’s dive into integrating Raygun for error monitoring and crash reporting in Uno Platform applications.

Visual Studio App Center Retirement

Tracking crashes and errors is a crucial part of development, and many of us have relied on App Center for this. With App Center’s recent retirement announcement, you might be wondering which tools to use for analytics and diagnostics to keep your Uno Platform applications running smoothly

Enter Raygun, a powerful crash reporting and performance monitoring tool with seamless integration across various platforms, including Uno Platform.

vsretire

Setting up Raygun

Raygun offers a free 14-day trial so you can explore its features before committing to a paid subscription. Here’s how to get started:

  1. Sign up for a  free Raygun Account:
  2. Create Your Application:
    • After you’ve signed up for a Raygun account, you will see a create a new application screen. You will need to give it an identifiable name, e.g. “MyApp – Production – Uno Platform”

    • Select “C#/.NET” as the language and “.NET 6+” as the framework and click on “Next step”.

 3. On the next screen, select “Crash Reporting” and click on “Next step”.

 4. You will now see the setup instructions for your Raygun app. Including the API key that you will need for the next step.

Integrating Raygun into your Uno Platform application

Assuming you’ve started a new Uno Platform project using the default template provided by the Uno Template Wizard, you can then:

Step 1 – Install the NuGet Package

In your IDE, go to Manage NuGet Packages, search for Mindscape.Raygun4Net.NetCore and install it into your project.

You can also use the following dotnet CLI command:

				
					dotnet add package Mindscape.Raygun4Net.NetCore
				
			

Step 2 – Create a RaygunClient

Create an instance of RaygunClient by passing a RaygunSettings object with your app API key. You can also enable automatic catching of unhandled exceptions:

				
					using Mindscape.Raygun4Net;

private static RaygunClient _raygunClient = new RaygunClient(new RaygunSettings()
{
  ApiKey = "YOUR_API_KEY_HERE",
  CatchUnhandledExceptions = true // Enable to log all unhandled exceptions
});

				
			

Remember to replace “YOUR_API_KEY_HERE” with the actual API key provided by Raygun when you created your application

Step 3 – Release and Test

Deploy Raygun into your production environment for real time results. To test the integration, you can raise a test exception:

				
					try
{
  throw new Exception("Temporary example exception to send to Raygun");
}
catch (Exception ex)
{
  _raygunClient.SendInBackground(ex);

				
			

Once Raygun detects your first error event, the dashboard will automatically update, so you can start monitoring your app’s crashes and exceptions.

Tip
Remember to configure Raygun for each platform your Uno application targets (iOS, Android, Windows, WebAssembly) to ensure comprehensive crash reporting across all environments.

For WebAssembly, navigate to the WebAssembly project, (or the main project if you are using the Single Project structure), and make sure to add support for WASM multithreading.
				
					<PropertyGroup> 
<WasmShellEnableThreads>true</WasmShellEnableThreads> 
</PropertyGroup>

				
			

By integrating Raygun Crash Reporting into your Uno Platform application, you gain valuable insights into your app’s performance and stability. This setup lets you quickly identify and resolve issues, leading to a better user experience and more robust applications.

Next Steps

Haven’t tried Uno Platform yet? Build stunning, native apps for mobile, web, desktop, and embedded systems—all from a single codebase. Open-source and free to use.

Tags:

Related Posts

Uno Platform 5.2 LIVE Webinar – Today at 3 PM EST – Watch