Backtrace 1.1.0
See the version list below for details.
dotnet add package Backtrace --version 1.1.0
NuGet\Install-Package Backtrace -Version 1.1.0
<PackageReference Include="Backtrace" Version="1.1.0" />
<PackageVersion Include="Backtrace" Version="1.1.0" />
<PackageReference Include="Backtrace" />
paket add Backtrace --version 1.1.0
#r "nuget: Backtrace, 1.1.0"
#:package Backtrace@1.1.0
#addin nuget:?package=Backtrace&version=1.1.0
#tool nuget:?package=Backtrace&version=1.1.0
Backtrace
Backtrace's integration with C# applications allows customers to capture and report handled and unhandled C# exceptions to their Backtrace instance, instantly offering the ability to prioritize and debug software errors.
Usage
var backtraceCredentials =
new BacktraceCredentials(@"https://myserver.sp.backtrace.io:6097", "4dca18e8769d0f5d10db0d1b665e64b3d716f76bf182fbcdad5d1d8070c12db0");
// replace with your endpoint url and token
var backtraceClient = new BacktraceClient(backtraceCredentials);
try{
//throw exception here
}
catch(Exception exception){
backtraceClient.Send(new BacktraceReport(exception));
}
Prerequisites
- On
Windows, we recommendVisual Studio 2017or above for IDE. You can download and installVisual Studiohere. As an alternative toVisual Studioyou can use .NET Core command line interface, see installation guide here - On
Mac OS X, you can download and installVisual Studiohere if you prefer using an IDE. For command line, you should to download and install .NET Core 2.0 or above. - On
Linux, Visual Studio Code is available as a light-weight IDE. Similarly, you can use .NET Core command line interface, see instruction forLinuxhere
Documentation
Initialize a new BacktraceClient
First create a BacktraceCredential instance with your Backtrace endpoint URL (e.g. https://xxx.sp.backtrace.io:6098) and submission token, and supply it as a parameter in the BacktraceClient constructor:
var credentials = new BacktraceCredentials("backtrace_endpoint_url", "token");
var backtraceClient = new BacktraceClient(credentials);
Additionally and optionally, BacktraceClient constructor also accepts the following parameters: custom attributes, database directory path and maximum number of error reports per minute.
var backtraceClient = new BacktraceClient(
sectionName: "BacktraceCredentials",
attributes: new Dictionary<string, object>() { { "Attribute", "value" } },
databaseDirectory: "pathToDatabaseDirectory",
reportPerMin: 0
);
Sending an error report
BacktraceClient.Send method will send an error report to the Backtrace endpoint specified. There Send method is overloaded, see examples below:
Using BacktraceReport
The BacktraceReport class extends BacktraceReportBase and represents a single error report. (Optional) You can also submit custom attributes using the attributes parameter, or attach files by supplying an array of file paths in the attachmentPaths parameter.
try
{
//throw exception here
}
catch (Exception exception)
{
var report = new BacktraceReport(
exception: exception,
attributes: new Dictionary<string, object>() { { "key", "value" } },
attachmentPaths: new List<string>() { @"file_path_1", @"file_path_2" }
);
var result = backtraceClient.Send(backtraceReport);
}
Asynchronous Send Support
For developers that use .NET 4.5+ and .NET Standard we recommend using SendAsync method, which uses asynchourous Tasks. Both Send and SendAsync method returns BacktraceResult. See example below:
try
{
//throw exception here
}
catch (Exception exception)
{
var report = new BacktraceReport(
exception: exception,
attributes: new Dictionary<string, object>() { { "key", "value" } },
attachmentPaths: new List<string>() { @"file_path_1", @"file_path_2" }
);
var result = await backtraceClient.SendAsync(backtraceReport);
}
Other BacktraceReport Overloads
BacktraceClient can also automatically create BacktraceReport given an exception or a custom message using the following overloads of the BacktraceClient.Send method:
try
{
//throw exception here
}
catch (Exception exception)
{
backtraceClient.Send(exception);
await backtraceClient.SendAsync("Message");
}
| Product | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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 | net35 is compatible. net40 was computed. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. 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. |
-
.NETFramework 3.5
- Newtonsoft.Json (>= 11.0.1)
-
.NETFramework 4.5
- Microsoft.Diagnostics.Runtime (>= 0.9.170809.3)
- Newtonsoft.Json (>= 11.0.1)
-
.NETStandard 2.0
- Newtonsoft.Json (>= 11.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.1.11 | 920 | 9/26/2024 |
| 2.1.10 | 6,772 | 7/3/2024 |
| 2.1.10-alpha1 | 196 | 7/3/2024 |
| 2.1.10-alpha | 171 | 7/3/2024 |
| 2.1.9 | 75,387 | 6/8/2020 |
| 2.1.8 | 1,222 | 3/26/2020 |
| 2.1.7 | 46,305 | 3/2/2020 |
| 2.1.6 | 1,010 | 10/11/2019 |
| 2.1.5 | 771 | 10/4/2019 |
| 2.1.4 | 1,057 | 8/2/2019 |
| 2.1.3 | 1,127 | 6/13/2019 |
| 2.1.2 | 1,092 | 6/7/2019 |
| 2.1.1 | 1,477 | 3/18/2019 |
| 2.1.0 | 1,094 | 3/12/2019 |
| 2.0.7 | 1,281 | 2/14/2019 |
| 2.0.6 | 1,695 | 12/19/2018 |
| 2.0.5 | 1,275 | 12/14/2018 |
| 2.0.4 | 1,506 | 9/24/2018 |
| 2.0.3 | 1,449 | 9/4/2018 |
| 1.1.0 | 1,896 | 4/2/2018 |
- BacktraceClient now supports an asynchronously SendAsync method that works with async task
- For .NET Framework 4.5 and .NET Standard 2.0, BacktraceClient now streams file attachment content directly from disk via SendAsync method.
- AfterSend event parameter changed. Now AfterSend event require BacktraceResult parameter, not BacktraceReport,
- Send and SendAsync method now returns BacktraceResult with information about report state,
- OnServerResponse now require BacktraceResult as a parameter.