获取更多动态,关注公众号:黑客下午茶
.NET
This section will describe features, configurations and general functionality which are specific to the .NET SDK.
ASP.NET
ASP.NET Core
AWS Lambda
Entity Framework
Microsoft.Extensions.Logging
log4net
NLog
Serilog
Windows Forms
Windows Presentation Foundation
Compatibility
The main Sentry NuGet package targets .NET Standard 2.0. That means, according to the compatibility table, it is compatible with the following versions or newer:
- .NET Framework 4.6.1 (4.7.2 advised)
- .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 run our unit/integration tests against:
- .NET 5 - Windows, macOS and Linux
- .NET Core 3.1 - Windows, macOS and Linux
- .NET Core 2.1 - Windows, macOS and Linux
- .NET Framework 4.8 - Windows
- Mono 5.12 - macOS and Linux
Using an older version of .NET Framework or Mono?
Our legacy SDK supports .NET Framework as early as 3.5.
Install
Add the Sentry dependency:
Copied
Install-Package Sentry -Version 2.1.8
Configure
Initialize the SDK as early as possible, like in the Main
method in Program.cs
/Program.fs
:
Program.cs
Copied
using (SentrySdk.Init("https://examplePublicKey@o0.ingest.sentry.io/0"))
{
// App code
}
Verify
Verify Sentry is capturing unhandled exceptions by raising an exception. For example, you can use the following snippet to raise a NullReferenceException
:
Copied
using (SentrySdk.Init("https://examplePublicKey@o0.ingest.sentry.io/0"))
{
throw null;
}
Samples
Resources
You can edit this page on GitHub.
- Package:
- nuget:Sentry
- Version:
- 2.1.8
- Repository:
- https://github.com/getsentry/sentry-dotnet