### Startup for .NET Framework
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Exceptionless/readme.txt
Import the Exceptionless namespace and call this line of code to start reporting unhandled exceptions.
```csharp
Exceptionless.ExceptionlessClient.Default.Startup()
```
--------------------------------
### Install Amazon.Lambda.Tools Global Tool
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleLambda/Readme.md
Install the Amazon.Lambda.Tools Global Tool if it is not already installed. This tool is used for deploying .NET applications to AWS Lambda.
```bash
dotnet tool install -g Amazon.Lambda.Tools
```
--------------------------------
### NLog.config with Exceptionless Target
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.NLog/readme.txt
Example NLog.config file demonstrating the Exceptionless NLog target. The apiKey attribute is optional. It's recommended to set minLevel to Trace for server-side control.
```xml
```
--------------------------------
### Web.config/App.config Configuration
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Configure Exceptionless using a config section in your web.config or app.config file. Ensure the correct NuGet package is installed to automatically add configuration elements.
```xml
...
...
```
--------------------------------
### Register for Unhandled Exception Reporting
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.Windows/readme.txt
Call this method after configuring your API key to start reporting unhandled exceptions automatically. Ensure the Exceptionless namespace is imported.
```csharp
Exceptionless.ExceptionlessClient.Default.Register()
```
--------------------------------
### Modify Unhandled Exception Reports
Source: https://github.com/exceptionless/exceptionless.net/wiki/Sending-Events
Wire up to the `SubmittingEvent` to get notified, add information, or ignore unhandled exceptions. This example shows how to cancel specific events based on error codes, types, or namespaces, and how to add custom data.
```csharp
using Exceptionless;
using System.Collections.Generic;
using System.Linq;
// Wire up to this event in somewhere in your application's startup code.
ExceptionlessClient.Default.SubmittingEvent += OnSubmittingEvent;
private void OnSubmittingEvent(object sender, EventSubmittingEventArgs e) {
// Only handle unhandled exceptions.
if (!e.IsUnhandledError)
return;
// Ignore 404s
if (e.Event.IsNotFound()) {
e.Cancel = true;
return;
}
// Get the error object.
var error = e.Event.GetError();
if (error == null)
return;
// Ignore 401 (Unauthorized) and request validation errors.
if (error.Code == "401" || error.Type == "System.Web.HttpRequestValidationException") {
e.Cancel = true;
return;
}
// Ignore any exceptions that were not thrown by our code.
var handledNamespaces = new List { "Exceptionless" };
if (!error.StackTrace.Select(s => s.DeclaringNamespace).Distinct().Any(ns => handledNamespaces.Any(ns.Contains))) {
e.Cancel = true;
return;
}
// Add some additional data to the report.
e.Event.AddObject(order, "Order", excludedPropertyNames: new [] { "CreditCardNumber" }, maxDepth: 2);
e.Event.Tags.Add("Order");
e.Event.MarkAsCritical();
e.Event.SetUserIdentity(user.EmailAddress);
}
```
--------------------------------
### Startup for .NET Core
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Exceptionless/readme.txt
Call the client.Startup() extension method on app startup to wire up error handlers and discover configuration settings.
```csharp
Exceptionless.ExceptionlessClient.Default.Startup("API_KEY_HERE")
```
--------------------------------
### Configure Self-Hosted Instance via Configuration File
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Set the 'serverUrl' in the configuration file to point to your self-hosted Exceptionless instance.
```xml
```
--------------------------------
### Configure Storage Options via Code
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Enable folder storage by providing a path or use isolated storage for persisting events. Folder storage requires appropriate file system permissions.
```csharp
// Use folder storage
ExceptionlessClient.Default.Configuration.UseFolderStorage("PATH OR FOLDER NAME");
// Use isolated storage
ExceptionlessClient.Default.Configuration.UseIsolatedStorage();
```
--------------------------------
### Register Exceptionless with Host Builder
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.Extensions.Hosting/readme.txt
Import the Exceptionless namespace and register Exceptionless on the host builder. `AddExceptionless(...)` configures the client, and `UseExceptionless()` ensures the pending queue is flushed during host shutdown.
```csharp
var builder = Host.CreateApplicationBuilder(args);
builder.AddExceptionless(c => c.ApiKey = "API_KEY_HERE");
builder.UseExceptionless();
```
--------------------------------
### Enable Client Logging via Configuration File
Source: https://github.com/exceptionless/exceptionless.net/wiki/Troubleshooting
Enable diagnostic logging for the Exceptionless client by adding the 'enableLogging' and 'logPath' attributes to the configuration element in your app/web.config file. Ensure the specified log path has write permissions.
```csharp
```
--------------------------------
### Add Custom Config Setting via Configuration File
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Use this snippet to add custom configuration settings like 'IncludeOrderData' in the Exceptionless client's configuration file.
```xml
```
--------------------------------
### Configure Self-Hosted Instance via Attribute
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Configure the Exceptionless client to send data to a self-hosted instance by specifying the 'ServerUrl' in the attribute.
```csharp
using Exceptionless.Configuration;
[assembly: Exceptionless("YOUR_API_KEY", ServerUrl = "http://localhost")]
```
--------------------------------
### Configure Exceptionless Client During Registration
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.Extensions.Logging/readme.txt
Configure the Exceptionless client directly when adding it to the logging builder. Replace 'API_KEY_HERE' with your actual API key.
```csharp
using Exceptionless;
var builder = Host.CreateApplicationBuilder(args);
builder.AddExceptionless(c => c.ApiKey = "API_KEY_HERE");
```
--------------------------------
### Enable Client Logging via Code
Source: https://github.com/exceptionless/exceptionless.net/wiki/Troubleshooting
Configure the Exceptionless client to use a file logger by calling the 'UseFileLogger' method with the desired log file path. This method requires the 'Exceptionless' namespace and ensures diagnostic messages are written to the specified file.
```csharp
using Exceptionless;
ExceptionlessClient.Default.Configuration.UseFileLogger("C:\\exceptionless.log");
```
--------------------------------
### Register and Configure Exceptionless Client in ASP.NET Core
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.AspNetCore/readme.txt
Add this code to your application's startup to register and configure the Exceptionless client for capturing unhandled exceptions. Ensure you replace 'API_KEY_HERE' with your actual API key.
```csharp
using Exceptionless;
var builder = WebApplication.CreateBuilder(args);
builder.AddExceptionless(c => c.ApiKey = "API_KEY_HERE");
builder.Services.AddProblemDetails();
var app = builder.Build();
app.UseExceptionHandler();
app.UseExceptionless();
```
--------------------------------
### Add Custom Config Setting via Attribute
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Apply custom configuration settings such as 'IncludeOrderData' using assembly attributes.
```csharp
using Exceptionless.Configuration;
[assembly: ExceptionlessSetting("IncludeOrderData", "true")]
```
--------------------------------
### XML Configuration for Exceptionless.NET
Source: https://github.com/exceptionless/exceptionless.net/wiki/Upgrading
Configure Exceptionless.NET using XML configuration. The `queuePath` has been renamed to `storagePath`, and `extendedData` to `data`. The `exceptionless` section is now part of the `Exceptionless` assembly. Note that XML configuration is not available when using only the PCL client.
```xml
```
--------------------------------
### Execute Unit Tests
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleLambda/Readme.md
Navigate to the test project directory and execute unit tests using the dotnet test command. This is a crucial step before deploying your Lambda function.
```bash
cd "BlueprintBaseName/test/BlueprintBaseName.Tests"
dotnet test
```
--------------------------------
### Enable Trace Message Collection via Configuration File
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Configure the Exceptionless client to include a specified number of recent trace log messages with event reports by setting 'TraceLogLimit' in the configuration file.
```xml
```
--------------------------------
### Submit Logs, Feature Usages, 404s, and Custom Events
Source: https://github.com/exceptionless/exceptionless.net/wiki/Sending-Events
Import the Exceptionless namespace to submit logs with optional source and level, track feature usages, report 404 errors, or send custom event types.
```csharp
// Import the exceptionless namespace.
using Exceptionless;
// Submit logs
ExceptionlessClient.Default.SubmitLog("Logging made easy");
// You can also specify the log source and log level.
// We recommend specifying one of the following log levels: Trace, Debug, Info, Warn, Error
ExceptionlessClient.Default.SubmitLog(typeof(Program).FullName, "This is so easy", "Info");
ExceptionlessClient.Default.CreateLog(typeof(Program).FullName, "This is so easy", "Info").AddTags("Exceptionless").Submit();
// Submit feature usages
ExceptionlessClient.Default.SubmitFeatureUsage("MyFeature");
ExceptionlessClient.Default.CreateFeatureUsage("MyFeature").AddTags("Exceptionless").Submit();
// Submit a 404
ExceptionlessClient.Default.SubmitNotFound("/somepage");
ExceptionlessClient.Default.CreateNotFound("/somepage").AddTags("Exceptionless").Submit();
// Submit a custom event type
ExceptionlessClient.Default.SubmitEvent(new Event { Message = "Low Fuel", Type = "racecar", Source = "Fuel System" });
```
--------------------------------
### Configure Proxy Settings in App/Web.config
Source: https://github.com/exceptionless/exceptionless.net/wiki/Troubleshooting
Manually configure proxy settings for the Exceptionless client within your application's configuration file. This is useful when automatic proxy detection fails or specific configurations are needed. Note that proxies are not supported in Portable Class Libraries.
```xml
```
--------------------------------
### Code-Based Configuration
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Configure Exceptionless directly in your code using the ExceptionlessClient constructor or by setting the API key on the default instance.
```csharp
using Exceptionless;
var client = new ExceptionlessClient(c => {
c.ApiKey = "YOUR_API_KEY";
c.SetVersion(version);
});
// You can also set the api directly on the default instance.
ExceptionlessClient.Default.Configuration.ApiKey = "YOUR_API_KEY"
```
--------------------------------
### Deploy Function to AWS Lambda
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleLambda/Readme.md
Navigate to the source project directory and deploy your function to AWS Lambda using the 'dotnet lambda deploy-function' command. Ensure you have configured your AWS credentials and settings.
```bash
cd "BlueprintBaseName/src/BlueprintBaseName"
dotnet lambda deploy-function
```
--------------------------------
### Add an Action-Based Plugin with Priority
Source: https://github.com/exceptionless/exceptionless.net/wiki/Adding-Plugins
Register a plugin using a lambda expression (System.Action) with a specified key and priority. This is useful for inline plugin logic or when you need to remove the plugin later by its key.
```csharp
using Exceptionless;
ExceptionlessClient.Default.Configuration.AddPlugin("system-uptime", 100, context => {
// Only update feature usage events.
if (context.Event.Type != Event.KnownTypes.FeatureUsage)
return;
// Get the system uptime
using (var pc = new PerformanceCounter("System", "System Up Time")) {
pc.NextValue();
var uptime = TimeSpan.FromSeconds(pc.NextValue());
// Store the system uptime as an extended property.
context.Event.SetProperty("System Uptime", String.Format("{0} Days {1} Hours {2} Minutes {3} Seconds", uptime.Days, uptime.Hours, uptime.Minutes, uptime.Seconds));
}
});
```
--------------------------------
### Environment Variable / Application Settings Configuration
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Configure Exceptionless by setting an environment variable or application setting with the key `Exceptionless:ApiKey` and your API key as the value.
```csharp
using Exceptionless;
ExceptionlessClient.Default.Configuration.ReadFromAttributes(typeof(MyClass).Assembly)
```
--------------------------------
### App.config Configuration for .NET Framework
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Exceptionless/readme.txt
If your project has an app.config file, add your Exceptionless api key to the Exceptionless section. The NuGet package will automatically configure the file.
```xml
```
--------------------------------
### Add Custom Tags via Configuration File
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Specify custom tags that will be automatically associated with every Exceptionless report using the configuration file.
```xml
```
--------------------------------
### Create a System Uptime Plugin
Source: https://github.com/exceptionless/exceptionless.net/wiki/Adding-Plugins
This C# plugin implements IEventPlugin to add system uptime information to feature usage events. It retrieves uptime using PerformanceCounter and sets it as an extended property.
```csharp
using System;
using System.Diagnostics;
using Exceptionless.Plugins;
using Exceptionless.Models;
namespace Exceptionless.SampleConsole.Plugins {
[Priority(100)]
public class SystemUptimePlugin : IEventPlugin {
public void Run(EventPluginContext context) {
// Only update feature usage events.
if (context.Event.Type != Event.KnownTypes.FeatureUsage)
return;
// Get the system uptime
using (var pc = new PerformanceCounter("System", "System Up Time")) {
pc.NextValue();
var uptime = TimeSpan.FromSeconds(pc.NextValue());
// Store the system uptime as an extended property.
context.Event.SetProperty("System Uptime", String.Format("{0} Days {1} Hours {2} Minutes {3} Seconds", uptime.Days, uptime.Hours, uptime.Minutes, uptime.Seconds));
}
}
}
}
```
--------------------------------
### Manually Update Configuration Settings
Source: https://github.com/exceptionless/exceptionless.net/wiki/Client-Configuration-Values
Manually trigger an update of the client configuration settings. This is useful when you need to ensure the client has the latest settings immediately.
```csharp
Exceptionless.Configuration.SettingsManager.UpdateSettings(ExceptionlessClient.Default.Configuration);
```
--------------------------------
### Register Exceptionless for Web API
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.WebApi/readme.txt
Call this method during application startup to enable automatic reporting of unhandled exceptions in your Web API. It requires an HttpConfiguration instance.
```csharp
Exceptionless.ExceptionlessClient.Default.RegisterWebApi(config)
```
--------------------------------
### Enable Session Tracking
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.Windows/readme.txt
Enable session tracking by calling this method during application startup. This feature provides application analytics by tracking user sessions.
```csharp
ExceptionlessClient.Default.Configuration.UseSessions()
```
--------------------------------
### Include Open Iconic Bootstrap Stylesheet
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleBlazorWebAssemblyApp/wwwroot/css/open-iconic/README.md
Link the Bootstrap-specific stylesheet for Open Iconic integration with the Bootstrap framework.
```html
```
--------------------------------
### Assembly Attribute Configuration for .NET Framework
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Exceptionless/readme.txt
If your project does not have an app.config file, add this assembly attribute and your Exceptionless api key to your project.
```csharp
[assembly: Exceptionless.Configuration.Exceptionless("API_KEY_HERE")]
```
--------------------------------
### Include Open Iconic Foundation Stylesheet
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleBlazorWebAssemblyApp/wwwroot/css/open-iconic/README.md
Link the Foundation-specific stylesheet for Open Iconic integration with the Foundation framework.
```html
```
--------------------------------
### Include Default Open Iconic Stylesheet
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleBlazorWebAssemblyApp/wwwroot/css/open-iconic/README.md
Link the default stylesheet for using Open Iconic icons independently of frameworks.
```html
```
--------------------------------
### Access and Use Custom Config Setting in Code
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Check custom configuration settings like 'IncludeOrderData' within your application code to conditionally include data in Exceptionless reports.
```csharp
using Exceptionless;
try {
...
} catch (Exception ex) {
var report = ex.ToExceptionless();
if (ExceptionlessClient.Default.Configuration.Settings["IncludeOrderData"] == "true")
report.AddObject(order);
report.Submit();
}
```
--------------------------------
### Add Static Extended Data via Configuration File
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Define static extended data values that will be automatically included with every Exceptionless report using the configuration file.
```xml
```
--------------------------------
### Subscribe to Configuration Setting Changes
Source: https://github.com/exceptionless/exceptionless.net/wiki/Client-Configuration-Values
Subscribe to the `Changed` event of the client's configuration settings to be notified when specific settings are updated. The event handler provides details about the changed item and the action performed.
```csharp
ExceptionlessClient.Default.Configuration.Settings.Changed += SettingsOnChanged;
private void SettingsOnChanged(object sender, ChangedEventArgs> args) {
Console.WriteLine("The key {0} was {1}", args.Item.Key, args.Action);
}
```
--------------------------------
### Add Exceptionless to Logging Builder
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.Extensions.Logging/readme.txt
Import the Exceptionless namespace and add Exceptionless to the logging builder. This is the basic integration step.
```csharp
using Exceptionless;
var builder = Host.CreateApplicationBuilder(args);
builder.Logging.AddExceptionless();
```
--------------------------------
### Assembly Attribute Configuration
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Configure Exceptionless using an assembly attribute. This attribute is only recognized if defined in the entry or calling assembly. Otherwise, explicitly read attributes during startup.
```csharp
using Exceptionless.Configuration;
[assembly: Exceptionless("YOUR_API_KEY")]
```
```csharp
using Exceptionless;
ExceptionlessClient.Default.Configuration.ReadFromAttributes(typeof(MyClass).Assembly)
```
--------------------------------
### Using Open Iconic SVGs
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleBlazorWebAssemblyApp/wwwroot/css/open-iconic/README.md
Display Open Iconic icons using the SVG format like any other image. Ensure to include an 'alt' attribute for accessibility.
```html
```
--------------------------------
### Disable Exceptionless via Configuration File
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Set 'enabled' to 'false' in the configuration file to disable Exceptionless from reporting events during testing.
```xml
```
--------------------------------
### Register Exceptionless for Web API hosted in ASP.NET
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.WebApi/readme.txt
Use this overload when hosting Web API within an ASP.NET application to register Exceptionless for exception reporting.
```csharp
Exceptionless.ExceptionlessClient.Default.RegisterWebApi(GlobalConfiguration.Configuration)
```
--------------------------------
### Use In-Memory Storage for Logging Targets
Source: https://github.com/exceptionless/exceptionless.net/wiki/Sending-Events
Configure the Exceptionless client to use in-memory storage for log messages when using NLog or Log4net targets for improved performance. This ensures log messages are stored in memory, while other exceptions still use disk storage.
```csharp
using Exceptionless;
ExceptionlessClient.Default.Configuration.UseInMemoryStorage();
```
--------------------------------
### Using Open Iconic with Foundation
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleBlazorWebAssemblyApp/wwwroot/css/open-iconic/README.md
Apply Open Iconic icons within a Foundation project using the 'fi-icon-name' class. Include 'title' and 'aria-hidden' attributes for accessibility.
```html
```
--------------------------------
### Sizing Icons with CSS
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleBlazorWebAssemblyApp/wwwroot/css/open-iconic/README.md
Control the size of icons by setting equal width and height dimensions on the SVG tag using CSS.
```css
.icon {
width: 16px;
height: 16px;
}
```
--------------------------------
### Enable Trace Message Collection via Attribute
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Use assembly attributes to enable the collection of trace log messages with event reports by setting 'TraceLogLimit'.
```csharp
using Exceptionless.Configuration;
[assembly: ExceptionlessSetting("TraceLogLimit", "10")]
```
--------------------------------
### Set Application Version
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Specify the application version using SetVersion to enable additional functionality. This is often resolved from assembly attributes by default but explicit setting is recommended.
```csharp
using Exceptionless;
ExceptionlessClient.Default.Configuration.SetVersion("1.2.3");
```
--------------------------------
### Using Open Iconic Standalone
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleBlazorWebAssemblyApp/wwwroot/css/open-iconic/README.md
Apply Open Iconic icons using the 'oi' class and the 'data-glyph' attribute for specifying the icon name. Include 'title' and 'aria-hidden' attributes for accessibility.
```html
```
--------------------------------
### Add Custom Tags via Code
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Programmatically add custom tags to be associated with every Exceptionless report.
```csharp
using Exceptionless;
ExceptionlessClient.Default.Configuration.DefaultTags.Add("Tag1");
```
--------------------------------
### Exceptionless Log4net Appender with API Key
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.Log4net/readme.txt
Configure the Exceptionless appender with an explicit API key. This overrides any default configuration.
```xml
```
--------------------------------
### Coloring Icons with CSS
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleBlazorWebAssemblyApp/wwwroot/css/open-iconic/README.md
Easily change the color of icons by setting the 'fill' property on the specific icon's class.
```css
.icon-account-login {
fill: #f00;
}
```
--------------------------------
### Configuring Exceptionless.NET with Assembly Attributes
Source: https://github.com/exceptionless/exceptionless.net/wiki/Upgrading
Configure Exceptionless.NET using assembly attributes. The `ExceptionlessAttribute` signature has changed to `ExceptionlessAttribute(string apiKey)`. If the attribute is not in the entry or calling assembly, you must explicitly specify the assembly containing the attribute.
```csharp
[assembly: Exceptionless("YOUR_API_KEY_HERE", ServerUrl = "...", StoragePath = "|DataDirectory|\Queue")]
...
// You must specify the assembly where the attribute is defined only if it's not defined in the entry or calling assembly.
ExceptionlessClient.Default.Configuration.ReadFromAttributes(typeof(Program).Assembly);
```
--------------------------------
### Add a Plugin Class to Exceptionless Client
Source: https://github.com/exceptionless/exceptionless.net/wiki/Adding-Plugins
Register a custom plugin class with the Exceptionless client configuration. This method is used when you have defined your plugin as a separate class implementing IEventPlugin.
```csharp
using Exceptionless;
ExceptionlessClient.Default.Configuration.AddPlugin();
```
--------------------------------
### Fine-grained PII Control via Code
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Configure specific PII data collection settings like username, machine name, IP address, cookies, POST data, and query strings to false. Data exclusions can be applied to cookies, form data, and query strings when enabled.
```csharp
// Include the username if available (E.G., Environment.UserName or IIdentity.Name)
ExceptionlessClient.Default.Configuration.IncludeUserName = false;
// Include the MachineName in MachineInfo.
ExceptionlessClient.Default.Configuration.IncludeMachineName = false;
// Include Ip Addresses in MachineInfo and RequestInfo.
ExceptionlessClient.Default.Configuration.IncludeIpAddress = false;
// Include Cookies, please note that DataExclusions are applied to all Cookie keys when enabled.
ExceptionlessClient.Default.Configuration.IncludeCookies = false;
// Include Form/POST Data, please note that DataExclusions are only applied to Form data keys when enabled.
ExceptionlessClient.Default.Configuration.IncludePostData = false;
// Include Query String information, please note that DataExclusions are applied to all Query String keys when enabled.
ExceptionlessClient.Default.Configuration.IncludeQueryString = false;
```
--------------------------------
### Disable PII Collection via Configuration File
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Set 'includePrivateInformation' to 'false' in the configuration file to disable the collection of all PII data.
```xml
```
--------------------------------
### Register HTTP Context Accessor for Manual Reporting
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.AspNetCore/readme.txt
Register the HTTP context accessor in your services to ensure request and user information is populated when manually reporting exceptions in ASP.NET Core.
```csharp
services.AddHttpContextAccessor()
```
--------------------------------
### Using Open Iconic with Bootstrap
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleBlazorWebAssemblyApp/wwwroot/css/open-iconic/README.md
Apply Open Iconic icons within a Bootstrap project using the 'oi' and 'oi-icon-name' classes. Include 'title' and 'aria-hidden' attributes for accessibility.
```html
```
--------------------------------
### Manually Reporting an Exception
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Exceptionless/readme.txt
Import the Exceptionless namespace and call this method to manually send an exception.
```csharp
exception.ToExceptionless().Submit()
```
--------------------------------
### Configure Folder Storage
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Use folder storage to persist events to disk for offline scenarios or to prevent data loss between application restarts. Ensure the application identity has full permissions to the specified folder. This adds overhead and is not recommended for high throughput.
```xml
```
--------------------------------
### Sending Additional Information with Events
Source: https://github.com/exceptionless/exceptionless.net/wiki/Sending-Events
Enhance error reports by adding custom data such as reference IDs, objects with excluded properties, tags, critical marks, geolocation, user identity, and user descriptions.
```csharp
try {
throw new ApplicationException("Unable to create order from quote.");
} catch (Exception ex) {
ex.ToExceptionless()
// Set the reference id of the event so we can search for it later (reference:id).
// This will automatically be populated if you call ExceptionlessClient.Default.Configuration.UseReferenceIds();
.SetReferenceId(Guid.NewGuid().ToString("N"))
// Add the order object but exclude the credit number property.
.AddObject(order, "Order", excludedPropertyNames: new [] { "CreditCardNumber" }, maxDepth: 2)
// Set the quote number.
.SetProperty("Quote", 123)
// Add an order tag.
.AddTags("Order")
// Mark critical.
.MarkAsCritical()
// Set the coordinates of the end user.
.SetGeo(43.595089, -88.444602)
// Set the user id that is in our system and provide a friendly name.
.SetUserIdentity(user.Id, user.FullName)
// Set the users description of the error.
.SetUserDescription(user.EmailAddress, "I tried creating an order from my saved quote.")
// Submit the event.
.Submit();
}
```
--------------------------------
### Update Amazon.Lambda.Tools Global Tool
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleLambda/Readme.md
Check if a new version of the Amazon.Lambda.Tools Global Tool is available and update it if necessary. This ensures you have the latest features and bug fixes.
```bash
dotnet tool update -g Amazon.Lambda.Tools
```
--------------------------------
### Basic Exceptionless Log4net Appender Configuration
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.Log4net/readme.txt
Configure the Exceptionless appender in your log4net configuration file. By default, it uses settings from the Exceptionless config section.
```xml
```
--------------------------------
### Enable WCF Exception Handling
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.Web/readme.txt
Apply the ExceptionlessWcfHandleError attribute to your WCF classes to enable Exceptionless to report exceptions from WCF services.
```csharp
[ExceptionlessWcfHandleError]
```
--------------------------------
### Add Static Extended Data via Code
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Programmatically add static extended data values to be included with every Exceptionless report.
```csharp
using Exceptionless;
ExceptionlessClient.Default.Configuration.DefaultData["Data1"] = "Exceptionless";
```
--------------------------------
### Set User Identity for Session Tracking
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.Windows/readme.txt
After enabling session tracking, call this method when a user logs in to associate sessions with a specific user. Provide a unique identifier and a display name for the user.
```csharp
ExceptionlessClient.Default.Configuration.SetUserIdentity("UNIQUE_ID_OR_EMAIL_ADDRESS", "Display Name")
```
--------------------------------
### Using Open Iconic SVG Sprite
Source: https://github.com/exceptionless/exceptionless.net/blob/main/samples/Exceptionless.SampleBlazorWebAssemblyApp/wwwroot/css/open-iconic/README.md
Incorporate icons from an SVG sprite for efficient loading. Add a general class to the SVG and a unique class to the 'use' tag for styling.
```html
```
--------------------------------
### Manually Report an Exception with HttpActionContext
Source: https://github.com/exceptionless/exceptionless.net/blob/main/src/Platforms/Exceptionless.WebApi/readme.txt
When submitting events in Web API, use this method to set the HttpActionContext. This populates request and user information for the reported event.
```csharp
exception.ToExceptionless().SetHttpActionContext(ActionContext).Submit()
```
--------------------------------
### Process Event Queue Manually
Source: https://github.com/exceptionless/exceptionless.net/wiki/Troubleshooting
Call this method before your application terminates to ensure all queued events are processed synchronously. This is crucial for short-lived processes or environments where background processing might be interrupted.
```csharp
ExceptionlessClient.Default.ProcessQueue();
```
--------------------------------
### Conditionally Cancel Log Submission
Source: https://github.com/exceptionless/exceptionless.net/wiki/Client-Configuration-Values
Register a plugin to conditionally cancel log event submission based on a client configuration setting. This allows runtime control over logging without redeploying.
```csharp
ExceptionlessClient.Default.Configuration.AddPlugin("Conditionally cancel log submission", 100, context => {
var enableLogSubmission = context.Client.Configuration.Settings.GetBoolean("enableLogSubmission", true);
// only cancel event submission if it’s a log event and enableLogSubmission is false
if (context.Event.Type == Event.KnownTypes.Log && !enableLogSubmission) {
context.Cancel = true;
}
});
```
--------------------------------
### Disable Automatic Configuration Updates
Source: https://github.com/exceptionless/exceptionless.net/wiki/Client-Configuration-Values
Turn off the automatic updating of client configuration settings when the client is idle. Set the `UpdateSettingsWhenIdleInterval` to `TimeSpan.Zero` to disable this feature.
```csharp
ExceptionlessClient.Default.Configuration.UpdateSettingsWhenIdleInterval = TimeSpan.Zero;
```
--------------------------------
### Remove an Action-Based Plugin by Key
Source: https://github.com/exceptionless/exceptionless.net/wiki/Adding-Plugins
Deregister a plugin that was added using a specific key, typically when it was registered as an action. This allows for targeted removal of inline or dynamically added plugins.
```csharp
using Exceptionless;
ExceptionlessClient.Default.Configuration.RemovePlugin("system-uptime");
```
--------------------------------
### Manually Sending Errors
Source: https://github.com/exceptionless/exceptionless.net/wiki/Sending-Events
Manually send exceptions to Exceptionless by catching them in a try-catch block and using the ToExceptionless().Submit() method.
```csharp
try {
throw new ApplicationException(Guid.NewGuid().ToString());
} catch (Exception ex) {
ex.ToExceptionless().Submit();
}
```
--------------------------------
### Disable PII Collection via Code
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Set the 'IncludePrivateInformation' property to 'false' in code to disable the collection of all PII data.
```csharp
ExceptionlessClient.Default.Configuration.IncludePrivateInformation = false;
```
--------------------------------
### Remove a Plugin Class from Exceptionless Client
Source: https://github.com/exceptionless/exceptionless.net/wiki/Adding-Plugins
Deregister a previously added plugin class from the Exceptionless client configuration. Use this when the plugin was added using its class type.
```csharp
using Exceptionless;
ExceptionlessClient.Default.Configuration.RemovePlugin();
```
--------------------------------
### Disable Exceptionless via Assembly Attribute
Source: https://github.com/exceptionless/exceptionless.net/wiki/Configuration
Use the Exceptionless assembly attribute with 'Enabled=false' to disable Exceptionless from reporting events during testing.
```csharp
using Exceptionless.Configuration;
[assembly: Exceptionless("YOUR_API_KEY", Enabled=false)]
```
--------------------------------
### Handling Event Submissions in Exceptionless.NET
Source: https://github.com/exceptionless/exceptionless.net/wiki/Upgrading
Use the `SubmittingEvent` event to process events before they are submitted. Check the `IsUnhandledError` property to differentiate between unhandled exceptions and other events. This replaces the removed `UnhandledExceptionReporting` event.
```csharp
ExceptionlessClient.Default.SubmittingEvent += OnSubmittingEvent;
...
private static void OnSubmittingEvent(object sender, EventSubmittingEventArgs e) {
if (!e.IsUnhandledError)
return;
if (e.Event.Message == "Important Exception")
e.Event.Tags.Add("Important");
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.