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.
Your BugSnag API key (required)
configuration.ApiKey = "your-api-key"
<bugsnag apiKey="your-api-key" />
You can find your API key in Project Settings from your BugSnag dashboard.
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" />
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" />
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" />
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" />
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" />
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>
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>
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 default value for this is 25.
configuration.MaximumBreadcrumbs = 25;
<bugsnag
apiKey="your-api-key"
maximumBreadcrumbs="25" />
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" />
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" />
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 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" />
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" />
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" />
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" />