Error reporting in .NET and ASP.NET Core

| 2 min. (368 words)

At Raygun we’ve been watching the development of the .NET Core framework since it was first announced. We are now proud to say that as of last week we fully support the .NET Core framework as a first class citizen with the new Raygun4Net.ASPNetCore provider.

Adding .NET Core support is simple

Using the new ASP.NET Core Raygun client is pretty easy.

  1. In your project.json file, add “Mindscape.Raygun4Net.AspNetCore”: “5.3.1”
to your dependencies.
  1. Run dotnet.exe restore or restore packages within Visual Studio to download the package.

  2. Add this to your appsettings.json

    "RaygunSettings": {
      "ApiKey": "PUT_YOUR_OWN_API_KEY_HERE"
    }

  3. In Startup.cs:

    1. Add using Mindscape.Raygun4Net; to your using statements.
    2. Add app.UseRaygun(); to the Configure method after any other ExceptionHandling methods.
    3. Add services.AddRaygun(Configuration); to the ConfigureServices method.

Following these simple steps will add the RaygunAspNetCoreMiddleware into the middleware pipeline and allows the Raygun client to report the exception before any other error handlers take over (I’m looking at you app.UseExceptionHandler() and app.UseDeveloperExceptionPage()).

Some missing features 🙁

Unfortunately there are still some missing features that would normally be found in the Raygun4Net provider. Be assured that as soon as these can be implemented in the .NET Core provider we will add them and release a new version. So for now the following are missing:

  • [dnxcore50] Only basic Environment information is set.
  • [All] No support for setting the Proxy to use for sending errors to Raygun API.
  • [All] The Version property is not automatically set from the AssemblyVersionAttribute.
  • [All] ServerVariables are missing.

Where to from here

We’ll be keeping an eye on the .NET Core Roadmap so we can add in the missing features as mentioned above as soon as we’re able. We’ll also be encouraging the community to follow our lead by bringing .NET Core support to your tools and libraries. The more that everyone gets behind and supports the .NET Core team and the community of developers the more we’ll all benefit.

What are you waiting for

There is a lot I haven’t covered in this post, like configuring the RaygunAspNetCoreMiddleware along with all the standard features you’ve come to expect of our other Raygun4Net clients.

So please go and read the full documentation here and start reporting errors in your .NET Core application today!