Airbrake Blog

Airbrake's New C#/.NET Notifier

Written by Kyrylo Silin | Mar 16, 2017 6:11:17 PM

We're excited to announce the new major release of our .NET notifier library! Airbrake has seen some serious feature improvements and upgrades during the last couple of years, but Sharpbrake hasn't gotten the love it deserved.

No more.

With this new library, .NET teams can enjoy all the benefits of Airbrake's error detection and monitoring, like real-time error alerts, deploy tracking, detailed error analysis and more.

Meet the new notifier

The new Sharpbrake library (v3) is a complete overhaul, with the library rewritten from scratch. We strived for simplicity, minimalism and ease of use, while also adding access to the broader set of Airbrake's most valuable features. We think you'll be happy with the results!

Here's the TL;DR:

  • Supports .NET versions 3.5 and 4.5 as well as the latest .NET Core platforms.
  • Seamlessly integrates with ASP.NET and ASP.NET Core.
  • Introduces custom parameters, nested exceptions and JSON exchange format.
  • Gives you total control of sensitive error data with blacklists and whitelists.
  • Sends all exceptions to Airbrake asynchronously.

Or, if you want more details:

The library uses the new Airbrake API (v3). With this API we can introduce our .NET customers to favorite features like custom parameters, nested exceptions, and JSON exchange format, just to name a few.

Sharpbrake supports .NET 3.5, 4.5 and the latest .NET Core platforms. We have an extensive test suite with good code coverage, so we can ship secure and stable code with confidence. Support for .NET Core platforms is a brand new feature.

With Sharpbrake v3 all exceptions are now sent to Airbrake asynchronously. This is the API the library exposes:

var airbrake = new AirbrakeNotifier(new AirbrakeConfig
{
ProjectId = "113743",
ProjectKey = "81bbff95d52f8856c770bb39e827f3f6"
});

try
{
throw new Exception();
}
catch(Exception ex)
{
airbrake.Notify(ex);
}

The Notify method is responsible for sending exceptions to the Airbrake dashboard. It also logs responses from our server. This method is consistent across all .NET runtimes. If you want more control over the logged response object, we expose a more powerful method called NotifyAsync. It's API is dependent on the .NET runtime you use. For example, for .NET 4.5 we use a task-based programming model with continuations and support for async/await keywords:

notifier.NotifyAsync(ex)
.ContinueWith(response => Console.WriteLine(response.Result.Url));

One of our most requested features was to provide a way to filter out sensitive data. Sharpbrake v3 provides access to both blacklists and whitelists, giving you complete control of your error data.

The library seamlessly integrates with ASP.NET via the bundled HTTP module and with ASP.NET Core via the bundled middleware.

There's absolutely no reason to stay with v2 and we encourage you to migrate to v3 as soon as possible.  Sharpbrake v2 is no longer supported.

Try it out

We encourage you to try out the new library. Sign up to start capturing exceptions in your .NET apps now! Get in touch if you have any questions, problems, feature ideas, or bug reports, we look forward to hearing from you!

New to Airbrake? Start your 14-day free trial today and you’ll be organizing and tracking all your application’s errors in just a few minutes.