Mindscape.Raygun4Net.NetCore
11.1.2
dotnet add package Mindscape.Raygun4Net.NetCore --version 11.1.2
NuGet\Install-Package Mindscape.Raygun4Net.NetCore -Version 11.1.2
<PackageReference Include="Mindscape.Raygun4Net.NetCore" Version="11.1.2" />
paket add Mindscape.Raygun4Net.NetCore --version 11.1.2
#r "nuget: Mindscape.Raygun4Net.NetCore, 11.1.2"
// Install Mindscape.Raygun4Net.NetCore as a Cake Addin #addin nuget:?package=Mindscape.Raygun4Net.NetCore&version=11.1.2 // Install Mindscape.Raygun4Net.NetCore as a Cake Tool #tool nuget:?package=Mindscape.Raygun4Net.NetCore&version=11.1.2
Raygun4Net.NetCore - Raygun Provider for .NET 6+ projects
Where is my app API key?
When you create a new application on your Raygun dashboard, your app API key is displayed within the instructions page. You can also find the API key by clicking the "Application Settings" button in the side bar of the Raygun dashboard.
Namespace
The main classes can be found in the Mindscape.Raygun4Net namespace.
Installation
Install the Mindscape.Raygun4Net.NetCore NuGet package into your project. You can either use the below dotnet CLI command, or the NuGet management GUI in the IDE you use.
dotnet add package Mindscape.Raygun4Net.NetCore
Create an instance of RaygunClient by passing your app API key to the constructor, and hook it up to the unhandled exception delegate. This is typically done in Program.cs or the main method.
using Mindscape.Raygun4Net;
private static RaygunClient _raygunClient = new RaygunClient("paste_your_api_key_here");
AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) =>
_raygunClient.Send(e.ExceptionObject as Exception);
Alternatively you can configure RaygunClient to automatically report any Unhandled Exceptions directly to Raygun
using Mindscape.Raygun4Net;
private static RaygunSettings _raygunSettings = new RaygunSettings
{
ApiKey = "paste_your_api_key_here",
CatchUnhandledExceptions = true // automatically reports any unhandled exceptions to Raygun
};
private static RaygunClient _raygunClient = new RaygunClient(_raygunSettings);
Add some temporary code to throw an exception and manually send it to Raygun.
try
{
...
}
catch (Exception e)
{
_raygunClient.SendInBackground(e);
}
Manually sending exceptions
The above instructions will setup Raygun4Net to automatically detect and send all unhandled exceptions. Sometimes you may want to send exceptions manually, such as handled exceptions from within a try/catch block.
RaygunClient provides Send and SendInBackground methods for manually sending to Raygun. It's important to note that SendInBackground should only be used for handled exceptions, rather than exceptions that will cause the application to crash - otherwise the application will most likely shutdown all threads before Raygun is able to finish sending.
Additional configuration options and features
Modify or cancel message
On a RaygunClient instance, attach an event handler to the SendingMessage event. This event handler will be called just before the RaygunClient sends an exception - either automatically or manually. The event arguments provide the RaygunMessage object that is about to be sent. One use for this event handler is to add or modify any information on the RaygunMessage. Another use for this method is to identify exceptions that you never want to send to raygun, and if so, set e.Cancel = true to cancel the send.
Strip wrapper exceptions
If you have common outer exceptions that wrap a valuable inner exception which you'd prefer to group by, you can specify these by using the multi-parameter method:
RaygunClient.AddWrapperExceptions(typeof(TargetInvocationException));
In this case, if a TargetInvocationException occurs, it will be removed and replaced with the actual InnerException that was the cause. Note that TargetInvocationException is already added to the wrapper exception list; you do not have to add this manually. This method is useful if you have your own custom wrapper exceptions, or a framework is throwing exceptions using its own wrapper.
Unique (affected) user tracking
There are properties named User and UserInfo on RaygunClient which you can set to provide user info such as ID and email address This allows you to see the count of affected users for each error in the Raygun dashboard. If you provide an email address, and the user has an associated Gravatar, you will see their avatar in the error instance page.
Make sure to abide by any privacy policies that your company follows when using this feature.
Version numbering
You can provide an application version value by setting the ApplicationVersion property of the RaygunClient (in the format x.x.x.x where x is a positive integer).
Offline storage
You can optionally specify an Offline Store for crash reports when creating your RaygunClient
.
When an offline store is specified, if there are any issues sending an exception to the Raygun API, a copy of the exception may be stored locally to be retried at a later date.
An exception is stored offline when one of the following conditions are met:
- There was a network connectivity issue, e.g. no active internet connection on a mobile device
- The Raygun API responded with an HTTP 5xx, indicating an unexpected server error
// Attempt to send any offline crash reports every 30 seconds
var sendStrategy = new TimerBasedSendStrategy(TimeSpan.FromSeconds(30));
// Store crash reports in Local AppData
var offlineStore = new LocalApplicationDataCrashReportStore(sendStrategy);
var raygunClient = new RaygunClient(new RaygunSettings()
{
ApiKey = "paste_your_api_key_here",
// Optionally store
OfflineStore = offlineStore
});
You may extend and create your own custom implementations of OfflineStoreBase
and IBackgroundSendStrategy
to further customize where errors are stored, and when they are sent.
Tags and custom data
When sending exceptions manually, you can also send an arbitrary list of tags (an array of strings), and a collection of custom data (a dictionary of any objects). This can be done using the various Send and SendInBackground method overloads.
See the Raygun docs for more detailed instructions on how to use this provider.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. |
.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. |
-
.NETStandard 2.0
- Mindscape.Raygun4Net.NetCore.Common (>= 11.1.2)
-
.NETStandard 2.1
- Mindscape.Raygun4Net.NetCore.Common (>= 11.1.2)
-
net6.0
- Mindscape.Raygun4Net.NetCore.Common (>= 11.1.2)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on Mindscape.Raygun4Net.NetCore:
Package | Downloads |
---|---|
Serilog.Sinks.Raygun
Serilog event sink that writes to the Raygun service. |
|
Mindscape.Raygun4Net.NetCore.Signed
Package is deprecated, please use `Mindscape.Raygun4Net.NetCore` which is signed. |
|
Raygun4Maui
Raygun's Crash Reporting and Real User Monitoring Provider for MAUI .NET |
|
Splat.Raygun
A library to make things cross-platform that should be. |
|
AspNetCore.AutoHealthCheck.Raygun
Auto Health Check integration for Raygun. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Mindscape.Raygun4Net.NetCore:
Repository | Stars |
---|---|
reactiveui/splat
Makes things cross-platform
|
Version | Downloads | Last updated |
---|---|---|
11.1.2 | 192 | 11/12/2024 |
11.1.2-pre-2 | 78 | 11/12/2024 |
11.1.2-pre-1 | 173 | 9/17/2024 |
11.1.1 | 15,273 | 9/12/2024 |
11.1.0 | 24,247 | 8/25/2024 |
11.0.4-pre-5 | 124 | 8/23/2024 |
11.0.4-pre-4 | 126 | 8/22/2024 |
11.0.4-pre-2 | 1,422 | 8/15/2024 |
11.0.4-pre-1 | 237 | 8/13/2024 |
11.0.3 | 10,912 | 7/25/2024 |
11.0.3-pre-1 | 93 | 7/22/2024 |
11.0.2 | 15,705 | 6/20/2024 |
11.0.1 | 6,218 | 6/14/2024 |
11.0.1-pre1 | 92 | 6/13/2024 |
11.0.0 | 3,750 | 6/9/2024 |
11.0.0-rc1 | 90 | 6/7/2024 |
11.0.0-pre3 | 101 | 5/30/2024 |
11.0.0-pre2 | 120 | 5/24/2024 |
11.0.0-pre1 | 102 | 5/23/2024 |
10.1.2 | 19,744 | 5/9/2024 |
10.1.2-pre-1 | 85 | 5/9/2024 |
10.1.1 | 16,065 | 3/27/2024 |
10.1.1-pre-1 | 107 | 3/20/2024 |
10.1.0 | 6,279 | 3/18/2024 |
10.1.0-pre-2 | 89 | 3/18/2024 |
10.1.0-pre-1 | 100 | 3/15/2024 |
10.0.0 | 1,332 | 3/13/2024 |
10.0.0-pre-6 | 105 | 3/12/2024 |
10.0.0-pre-5 | 101 | 3/12/2024 |
10.0.0-pre-4 | 128 | 2/23/2024 |
10.0.0-pre-2 | 99 | 2/23/2024 |
10.0.0-pre-1 | 95 | 2/22/2024 |
9.0.4 | 5,220 | 3/3/2024 |
9.0.4-pre-1 | 100 | 2/29/2024 |
9.0.3 | 1,334 | 2/27/2024 |
9.0.2 | 808 | 2/22/2024 |
9.0.2-pre-1 | 87 | 2/19/2024 |
9.0.1 | 4,185 | 2/8/2024 |
9.0.0-pre3 | 99 | 2/7/2024 |
9.0.0-pre-1 | 93 | 2/2/2024 |
8.3.0-pre1 | 114 | 1/26/2024 |
8.1.0-pre6 | 2,101 | 1/14/2024 |
8.1.0-pre5 | 95 | 1/14/2024 |
8.1.0-pre3 | 719 | 1/9/2024 |
8.1.0-pre2 | 76 | 1/9/2024 |
8.1.0-pre1 | 321 | 12/21/2023 |
8.0.1 | 21,205 | 11/28/2023 |
8.0.1-pre-1 | 120 | 11/27/2023 |
8.0.0 | 33,148 | 11/14/2023 |
8.0.0-pre-1 | 8,914 | 11/9/2023 |
7.1.0 | 21,094 | 10/9/2023 |
7.1.0-pre-1 | 127 | 9/22/2023 |
7.0.0 | 14,407 | 9/12/2023 |
6.7.0 | 28,764 | 8/28/2023 |
6.7.0-pre2 | 151 | 8/21/2023 |
6.4.3 | 206,483 | 2/28/2022 |
6.4.2 | 491 | 2/23/2022 |
6.4.1 | 117,572 | 9/2/2021 |
6.3.1 | 507,017 | 8/17/2020 |
6.3.0 | 9,216 | 6/30/2020 |
6.2.1-beta1 | 488 | 2/13/2020 |
6.2.0 | 130,555 | 10/9/2019 |
6.0.1 | 87,949 | 10/4/2018 |
6.0.0 | 11,328 | 5/28/2018 |
5.5.4 | 12,347 | 4/27/2018 |