Configuration options

All available options for configuring your integration with Bugsnag.

You can use the Bugsnag.ConfigurationSection NuGet package to configure Bugsnag via the Web.config or App.config file. This is generally included automatically via the main NuGet package for your platform. Each key provides an in code example and a config file example.

API Key

Your Bugsnag API key (required)

configuration.ApiKey = "your-api-key"
<bugsnag apiKey="your-api-key" />

App Type

You can set the type of application executing the current code by using this key.

configuration.AppType = "worker";
<bugsnag
  apiKey="your-api-key"
  appType="worker" />

App Version

If you want to track which versions of your application each exception happens in, you can set AppVersion.

configuration.AppVersion = "2.5.1";
<bugsnag
  apiKey="your-api-key"
  appVersion="2.5.1" />

Auto Capture Sessions

Set to true if you would like Bugsnag to automatically capture sessions. Using this option in a web framework that we support will report a session each time a request is received.

configuration.AutoCaptureSessions = true;
<bugsnag
  apiKey="your-api-key"
  autoCaptureSessions="true" />

Auto Notify

By default we will automatically notify Bugsnag of any fatal exceptions in your application. Use this option if you want to stop this from happening.

configuration.AutoNotify = false;
<bugsnag
  apiKey="your-api-key"
  autoNotify="false" />

Endpoint

Sets the URL used to send error reports to Bugsnag. This defaults to https://notify.bugsnag.com, but should be overridden if you are using Bugsnag On-premise, to point to your own Bugsnag endpoint.

configuration.Endpoint = new Uri("https://bugsnag.internal.example.com");
<bugsnag
  apiKey="your-api-key"
  endpoint="https://bugsnag.internal.example.com" />

Global Metadata

Metadata that will be attached to all error reports sent by the client.

configuration.GlobalMetadata = new[] { new KeyValuePair<string, object>("account", new System.Collections.Generic.Dictionary<string, string> { { "company", "Acme Co." } }) };
<bugsnag apiKey="your-api-key">
  <metadata>
    <item key="company" value="Acme Co." />
  </metadata>
</bugsnag>

Ignore Classes

A list of exception types that should be ignored. If a report contains exceptions of these types then the report will not be sent to Bugsnag. Checks to see if each exception type is in the inheritance hierarchy of each IgnoreClass or is an interface that the exception implements.

In the config file this must be the AssemblyQualifiedName

configuration.IgnoreClasses = new [] { typeof(Bugsnag.NotThatBadException), typeof(System.NotImplementedException) };
<bugsnag apiKey="your-api-key">
  <assemblyQualifiedIgnoreClasses>
    <class name="System.NotImplementedException" />
    <class name="Bugsnag.NotThatBadException, Bugsnag" />
  </assemblyQualifiedIgnoreClasses>
</bugsnag>

Maximum Breadcrumbs

This is the maximum number of breadcrumbs that will be sent along with each error report. The maximum payload size is 1MB and breadcrumbs will be stripped if the client is unable to send the report due to a large number of breadcrumbs. The defualt value for this is 25.

configuration.MaximumBreadcrumbs = 25;
<bugsnag
  apiKey="your-api-key"
  maximumBreadcrumbs="25" />

Metadata Filters

Sets which keys should be filtered out from metadata before sending them to Bugsnag. Use this if you want to ensure you don’t send sensitive data such as passwords, and credit card numbers to our servers. Any keys in the metadata of the error report will have their values replaces with [FILTERED]. By default these are populated with the following values: “password”, “Authorization”.

configuration.MetadataFilters = new [] { "password", "creditcard" };
<bugsnag
  apiKey="your-api-key"
  metadataFilters="password,creditcard" />

Notify Release Stages

By default, we will notify Bugsnag of exceptions that happen in any ReleaseStage. If you would like to change which release stages notify Bugsnag of exceptions you can set NotifyReleaseStages:

configuration.NotifyReleaseStages = new [] { "staging", "production" };
<bugsnag
  apiKey="your-api-key"
  notifyReleaseStages="staging,production" />

Project Namespaces

We mark stacktrace lines as inProject if they come from namespaces included in your project namespaces.

configuration.ProjectNamespaces = new [] { "App.Code", "Bugsnag.Tests" };
<bugsnag
  apiKey="your-api-key"
  projectNamespaces="App.Code,Bugsnag.Tests" />

Project Roots

Project roots are used to strip file paths in each error reports stack trace in order to normalize them across builds.

configuration.ProjectRoots = new [] { @"C:\app", @"D:\src" };
<bugsnag
  apiKey="your-api-key"
  projectRoots="C:\app,D:\src" />

Proxy

Sets the address of the HTTP proxy that should be used for requests to Bugsnag. You can also provide authentication details.

var credential = new System.Net.NetworkCredential(username, password);
var proxyAddress = new Uri("https://hostname:port");
configuration.Proxy = new System.Net.WebProxy(proxyAddress, false, null, credential);
<bugsnag
  apiKey="your-api-key"
  proxyAddress="https://hostname:port"
  proxyUsername="bugsnag"
  proxyPassword="password" />

Release Stage

If you would like to distinguish between errors that happen in different stages of the application release process (development, production, etc) you can set the ReleaseStage that is reported to Bugsnag. This will default to production if not specified.

configuration.ReleaseStage = "development";
<bugsnag
  apiKey="your-api-key"
  releaseStage="development" />

Session Endpoint

Set the endpoint to which tracked sessions reports are sent. This defaults to https://sessions.bugsnag.com, but should be overridden if you are using Bugsnag On-premise, to point to your own Bugsnag endpoint.

configuration.SessionEndpoint = new Uri("https://sessions.example.com");
<bugsnag
  apiKey="your-api-key"
  sessionsEndpoint="https://sessions.example.com" />