Backtrace 1.1.2

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.

There is a newer version of this package available.
See the version list below for details.
Install-Package Backtrace -Version 1.1.2
dotnet add package Backtrace --version 1.1.2
<PackageReference Include="Backtrace" Version="1.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Backtrace --version 1.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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 recommend Visual Studio 2017 or above for IDE. You can download and install Visual Studio here. As an alternative to Visual Studio you can use .NET Core command line interface, see installation guide here
  • On Mac OS X, you can download and install Visual Studio here 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 for Linux here

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");
}

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 recommend Visual Studio 2017 or above for IDE. You can download and install Visual Studio here. As an alternative to Visual Studio you can use .NET Core command line interface, see installation guide here
  • On Mac OS X, you can download and install Visual Studio here 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 for Linux here

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");
}

Release Notes

Fix: Clean Backtrace client’s data storage on startup

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.1.9 123 6/8/2020
2.1.8 329 3/26/2020
2.1.7 142 3/2/2020
2.1.6 310 10/11/2019
2.1.5 121 10/4/2019
2.1.4 414 8/2/2019
2.1.3 405 6/13/2019
2.1.2 422 6/7/2019
2.1.1 722 3/18/2019
2.1.0 428 3/12/2019
2.0.7 508 2/14/2019
2.0.6 616 12/19/2018
2.0.5 453 12/14/2018
2.0.4 681 9/24/2018
2.0.3 586 9/4/2018
2.0.2 495 8/28/2018
2.0.1 683 7/17/2018
2.0.0 594 7/10/2018
1.3.2 682 7/3/2018
1.3.1 673 6/28/2018
1.3.0 644 6/26/2018
1.2.3 698 6/21/2018
1.2.2 711 6/19/2018
1.2.1 627 6/14/2018
1.2.0 797 5/5/2018
1.1.4 622 4/27/2018
1.1.2 606 4/9/2018
1.1.1 649 4/9/2018
1.1.0 736 4/2/2018
1.0.3 651 3/20/2018
Show less