Sentry 0.0.1-preview5

Prefix Reserved
This is a prerelease version of Sentry.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Sentry --version 0.0.1-preview5                
NuGet\Install-Package Sentry -Version 0.0.1-preview5                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Sentry" Version="0.0.1-preview5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sentry --version 0.0.1-preview5                
#r "nuget: Sentry, 0.0.1-preview5"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Sentry as a Cake Addin
#addin nuget:?package=Sentry&version=0.0.1-preview5&prerelease

// Install Sentry as a Cake Tool
#tool nuget:?package=Sentry&version=0.0.1-preview5&prerelease                

Below you will find a basic introduction to the SDK and its API.

For more details, please: refer to the SDK documentation

Main features

  • Automatic Captures global unhandled exceptions (AppDomain)
  • Scope management
  • Duplicate events automatically dropped
  • Events from the same exception automatically dropped
  • Web proxy support
  • HttpClient/HttpClientHandler configuration callback
  • Compress request body
  • Event sampling opt-in
  • Event flooding protection (429 retry-after and internal bound queue)
  • DSN discovered via environment variable
  • Release (version) reported automatically
  • CLS Compliant
  • Strong named
  • SourceLink (including PDB in nuget package)
  • Device OS info sent
  • Device Runtime info sent
  • Tested on Windows, Linux and macOS
  • Tested on .NET Core, .NET Framework and Mono

Basics

Initialize the SDK:

void Main() 
{
    using (SentrySdk.Init("dsn"))
    {
        // App code
    }
}

The SDK by default will watch for unhandled exceptions in your app. If the DSN is not explicitly passed by parameter to Init, the SDK will try to locate it via environment variable SENTRY_DSN.

To configure advanced settings, for example a proxy server:

void Main() 
{
    using (SentrySdk.Init(o =>
    {
        o.Dsn = new Dsn("dsn");
        o.Http(h =>
        {
            h.Proxy = new WebProxy("https://localhost:3128");
        });
    }))
    {
        // App code
    }
}

Capture an exception:

try
{
    throw null;
}
catch (Exception e)
{
    SentrySdk.CaptureException(e);
}

Capture a message:

SentrySdk.CaptureMessage("this just happened");

Internals/Testability

It's often the case we don't want to couple our code with static class like SentrySdk, especially to allow our code to be testable. If that's your case, you can use 2 abstractions:

  • ISentryClient
  • IHub

The ISentryClient is responsible to queueing the event to be sent to Sentry and abstracting away the internal transport. The IHub on the other hand, holds a client and the current scope. It in fact also implements ISentryClient and is able to dispatch calls to the right client depending on the current scope.

In order to allow different events hold different contextual data, you need to know in which scope you are in. That's the job of the Hub. It holds the scope management as well as a client.

If all you are doing is sending events, without modification/access to the current scope, then you depend on ISentryClient. If on the other hand you would like to have access to the current scope by configuring it or binding a different client to it, etc. You'd depend on IHub.

An example using IHub for testability is SentryLogger and its unit tests SentryLoggerTests.
SentryLogger depends on IHub because it does modify the scope (through AddBreadcrumb). In case it only sent events, it should instead depend on ISentryClient

Compatibility

The packages target .NET Standard 2.0. That means it is compatible with the following versions or newer:

  • .NET Framework 4.6.1
  • .NET Core 2.0
  • Mono 5.4
  • Xamarin.Android 8.0
  • Xamarin.Mac 3.8
  • Xamarin.iOS 10.14
  • Universal Windows Platform 10.0.16299

Of those, we've tested (we run our unit/integration tests) against:

  • .NET Framework 4.6.2 on Windows (AppVeyor)
  • Mono 5.12 macOS and Linux (Travis-CI)
  • .NET Core 2.0 Windows (AppVeyor), macOS and Linux (Travis-CI)
  • .NET Core 2.1 Windows (AppVeyor), macOS and Linux (Travis-CI)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (79)

Showing the top 5 NuGet packages that depend on Sentry:

Package Downloads
Sentry.Extensions.Logging

Official Microsoft.Extensions.Logging integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.

Sentry.Serilog

Official Serilog integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.

Sentry.NLog

Official NLog integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.

Sentry.DiagnosticSource

Official Diagnostic.Listener integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time. Note: This package is not needed when using Sentry with .NET Core 3 or higher.

VisioForge.DotNet.Core

VisioForge .Net products for video capture, editing and playback (Video Capture SDK, Media Player SDK, Video Edit SDK). Core package.

GitHub repositories (51)

Showing the top 5 popular GitHub repositories that depend on Sentry:

Repository Stars
files-community/Files
A modern file manager that helps users organize their files and folders.
ppy/osu
rhythm is just a *click* away!
Sonarr/Sonarr
Smart PVR for newsgroup and bittorrent users.
Radarr/Radarr
Movie organizer/manager for usenet and torrent users.
LykosAI/StabilityMatrix
Multi-Platform Package Manager for Stable Diffusion
Version Downloads Last updated
5.0.0 37,394 12/19/2024
5.0.0-alpha.1 2,630 11/25/2024
5.0.0-alpha.0 132 11/24/2024
4.13.0 686,368 11/5/2024
4.12.2 44,861 11/2/2024
4.12.1 526,012 10/10/2024
4.12.1-segv1 746 11/1/2024
4.12.0 206,628 10/2/2024
4.11.0 420,250 9/22/2024
4.10.2 859,452 8/21/2024
4.10.1 144,728 8/16/2024
4.10.0 55,254 8/14/2024
4.9.0 1,098,582 7/11/2024
4.9.0-sync.collection.2 230 7/30/2024
4.9.0-sync.collection.1 111 7/30/2024
4.8.1 240,631 7/2/2024
4.8.0 205,356 6/26/2024
4.7.0 946,978 5/27/2024 4.7.0 is deprecated.
4.6.2 419,373 5/14/2024 4.6.2 is deprecated.
4.6.0 97,481 5/9/2024 4.6.0 is deprecated.
4.5.0 286,444 4/30/2024 4.5.0 is deprecated.
4.4.0 490,292 4/12/2024 4.4.0 is deprecated.
4.3.0 153,350 4/10/2024 4.3.0 is deprecated.
4.2.1 823,700 3/12/2024 4.2.1 is deprecated.
4.2.0 42,514 3/11/2024 4.2.0 is deprecated.
4.1.2 1,134,546 2/20/2024 4.1.2 is deprecated.
4.1.1 188,979 2/14/2024 4.1.1 is deprecated.
4.1.0 171,886 2/9/2024 4.1.0 is deprecated.
4.0.3 75,707 2/7/2024 4.0.3 is deprecated.
4.0.2 74,949 2/6/2024 4.0.2 is deprecated.
4.0.1 41,474 2/5/2024 4.0.1 is deprecated.
4.0.0 111,664 2/1/2024 4.0.0 is deprecated.
4.0.0-beta.9 1,128 1/30/2024
4.0.0-beta.8 18,065 1/11/2024
4.0.0-beta.7 7,929 1/5/2024
4.0.0-beta.6 17,584 12/13/2023
4.0.0-beta.5 2,532 12/12/2023
4.0.0-beta.4 19,851 12/5/2023
4.0.0-beta.3 592 12/2/2023
4.0.0-beta.2 4,746 11/23/2023
4.0.0-beta.1 1,043 11/19/2023
4.0.0-beta.0 591 11/17/2023
4.0.0-alpha.0 6,307 11/9/2023
3.41.4 1,144,851 1/23/2024
3.41.3 1,553,179 11/29/2023
3.41.2 332,332 11/23/2023
3.41.1 75,894 11/22/2023
3.41.0 916,693 11/8/2023
3.40.1 787,428 10/12/2023
3.40.0 139,760 10/10/2023
3.40.0-beta.0 15,140 9/21/2023
3.39.1 1,532,504 9/12/2023
3.39.0 218,740 9/7/2023
3.36.0 620,155 8/22/2023
3.35.1 253,035 8/16/2023
3.35.0 173,275 8/8/2023 3.35.0 is deprecated.
3.34.0 1,145,593 7/13/2023
3.33.1 1,333,623 6/13/2023
3.33.0 1,174,305 5/22/2023
3.32.0 26,912 5/22/2023
3.31.0 770,294 5/2/2023
3.30.0 1,182,595 4/11/2023
3.29.1 1,796,736 3/11/2023
3.29.0 243,001 3/6/2023
3.28.1 1,386,666 2/10/2023
3.28.0 75,328 2/8/2023
3.27.1 337,285 2/3/2023
3.27.0 147,640 2/1/2023
3.26.2 694,378 1/24/2023
3.26.1 280,699 1/17/2023
3.26.0 365,827 1/13/2023
3.25.0 1,196,758 12/23/2022
3.24.1 347,382 12/16/2022
3.24.0 1,711,347 11/18/2022
3.23.1 902,211 10/31/2022
3.23.0 102,002 10/27/2022
3.22.0 1,418,101 10/7/2022
3.21.0 1,727,079 9/2/2022
3.20.1 1,702,779 7/26/2022
3.19.0 956,599 6/28/2022
3.18.0 613,870 6/15/2022
3.17.1 1,438,354 5/8/2022
3.17.0 146,539 5/3/2022
3.16.0 977,557 4/7/2022
3.15.0 991,412 3/15/2022
3.14.1 904,234 2/18/2022
3.14.0 210,179 2/14/2022
3.13.0 1,490,287 1/11/2022
3.12.3 1,067,734 12/19/2021
3.12.2 83,980 12/15/2021
3.12.1 369,630 12/6/2021
3.12.0 296,170 11/23/2021
3.12.0-alpha.1 6,030 11/7/2021
3.11.1 685,055 11/5/2021
3.11.0 157,186 11/2/2021
3.10.0 653,260 10/15/2021
3.9.4 989,310 9/29/2021
3.9.3 172,251 9/21/2021
3.9.2 237,974 9/10/2021
3.9.1 14,526 9/9/2021
3.9.0 306,612 8/27/2021
3.8.3 827,469 7/25/2021
3.8.2 141,741 7/17/2021
3.8.1 27,847 7/15/2021
3.8.0 121,382 7/14/2021
3.7.0 136,638 7/10/2021
3.6.1 182,236 7/2/2021
3.6.0 238,036 6/23/2021
3.6.0-alpha.2 657 6/18/2021
3.6.0-alpha.1 1,264 6/11/2021
3.5.0 479,614 6/7/2021 3.5.0 is deprecated because it has critical bugs.
3.4.0 151,999 5/31/2021 3.4.0 is deprecated because it has critical bugs.
3.4.0-beta.0 334 5/27/2021 3.4.0-beta.0 is deprecated because it has critical bugs.
3.3.5-beta.0 2,573 5/13/2021
3.3.4 767,495 4/26/2021
3.3.3 9,167 4/23/2021
3.3.2 24,801 4/23/2021
3.3.1 577,051 4/5/2021
3.3.0 34,090 4/3/2021
3.2.0 132,544 3/26/2021
3.1.0 387,373 3/10/2021
3.0.8 71,038 3/4/2021
3.0.7 242,164 2/20/2021
3.0.6 102,713 2/14/2021
3.0.5 70,961 2/9/2021
3.0.4 31,914 2/8/2021
3.0.3 79,821 2/3/2021
3.0.2 22,892 2/3/2021
3.0.1 143,508 1/29/2021
3.0.0 41,508 1/28/2021
3.0.0-beta.0 6,134 1/20/2021
3.0.0-alpha.11 499 1/15/2021
3.0.0-alpha.10 63,901 1/10/2021
3.0.0-alpha.9 2,271 12/29/2020
3.0.0-alpha.8 4,552 12/25/2020
3.0.0-alpha.7 3,001 12/16/2020
3.0.0-alpha.6 3,755 11/30/2020
3.0.0-alpha.5 3,299 11/21/2020
3.0.0-alpha.4 2,461 11/2/2020
3.0.0-alpha.3 1,811 10/29/2020
3.0.0-alpha.2 856 10/21/2020
3.0.0-alpha.1 6,104 10/16/2020
3.0.0-alpha.0 2,123 9/25/2020
2.2.0-alpha 2,546 9/19/2020
2.1.8 2,053,628 11/21/2020
2.1.6 2,118,281 8/20/2020
2.1.5 606,310 7/27/2020
2.1.5-beta 4,252 6/30/2020
2.1.4 630,709 6/25/2020
2.1.3 694,568 6/5/2020
2.1.2-beta5 7,980 5/19/2020
2.1.2-beta4 4,983 5/12/2020
2.1.2-beta3 2,118 5/7/2020
2.1.2-beta2 22,195 4/16/2020
2.1.2-beta 4,408 3/31/2020
2.1.1 1,586,733 3/19/2020
2.1.0 771,076 2/24/2020
2.0.3 594,915 2/12/2020
2.0.2 36,338 2/8/2020
2.0.1 277,742 1/28/2020
2.0.0-beta8 24,240 1/15/2020
2.0.0-beta7 162,684 12/17/2019
2.0.0-beta6 103,074 10/31/2019
2.0.0-beta5 7,355 10/29/2019
2.0.0-beta4 75,920 9/4/2019
2.0.0-beta3 17,210 7/26/2019
2.0.0-beta2 6,269 6/9/2019
2.0.0-beta 3,378 6/4/2019
1.2.1-beta 2,228 5/27/2019
1.2.0 3,160,520 5/23/2019
1.1.3-beta4 2,025 5/15/2019
1.1.3-beta3 1,812 5/13/2019
1.1.3-beta2 7,983 3/28/2019
1.1.3-beta 5,480 2/11/2019
1.1.2 636,682 1/16/2019
1.1.2-beta 3,630 1/8/2019
1.1.1 24,451 1/5/2019
1.1.0 116,274 12/5/2018
1.0.1-beta5 2,731 12/5/2018
1.0.1-beta4 3,477 12/3/2018
1.0.1-beta3 18,489 11/15/2018
1.0.1-beta2 3,374 11/14/2018
1.0.1-beta 20,945 10/24/2018
1.0.0 292,247 10/2/2018
1.0.0-rc2 24,682 9/7/2018
1.0.0-rc 5,991 8/24/2018
0.0.1-preview5 7,580 8/5/2018
0.0.1-preview4 5,136 7/30/2018
0.0.1-preview3 6,707 7/17/2018
0.0.1-preview2 6,082 7/3/2018
0.0.1-preview1 2,659 6/28/2018