SDK guides

ASP.NET Core & .NET

The .NET SDK is the backend error SDK for ASP.NET Core and any other .NET app. Capture unhandled exceptions, logged errors and manual captures from your .NET backend and file them into the same Fixback pipeline your frontend uses — one queue for your whole product.

Backend errors authenticate with a secret key, so they arrive Internal tier and tagged platform: dotnet. Fleet-wide crash-loops collapse into a single Issue with a rising occurrence count instead of flooding your queue.

Every secret key belongs to one of the Project's environments, and a backend error lands in the environment of the key that sent it — so there is no environment option. Give each server its own environment's key: Staging's on the staging server, Production's in production.

Install

shell
dotnet add package Fixback.AspNetCore

The SDK ships as four NuGet packages, each for .NET 8 and .NET 10: Fixback (the core, with no dependencies), Fixback.Extensions.Logging (ILogger and the Generic Host), and Fixback.AspNetCore (the middleware), which brings the other two with it — plus Fixback.Serilog, the sink for an app that logs through Serilog.

Quick start

Add one line to Program.cs, right after the builder is created:

Program.cs
var builder = WebApplication.CreateBuilder(args);builder.WebHost.UseFixback(); // reads FIXBACK_SECRET_KEY and the "Fixback" config sectionvar app = builder.Build();// … your middleware and endpoints …app.Run();

That single call wires:

  • the request middleware, added for you at the very start of the pipeline — there is no app.Use… line. It captures exceptions that escape a request, ones UseExceptionHandler or an IExceptionHandler handled, and the developer exception page's, with the request's route pattern, method, and status;
  • ILogger capture — an error you log at Error or above is filed too;
  • process-level capture of unhandled exceptions and unobserved task exceptions, filed as handled: false;
  • and a batched secret-key transport that keeps an error until Fixback has filed it — retrying, honouring Retry-After — and sends what is queued when the app shuts down (see Delivery).

A request the client aborted is not captured — a cancelled request is not a defect.

Configuration

Options bind from the "Fixback" configuration section — appsettings.json, environment variables such as Fixback__SecretKey, user-secrets — and then from the callback, which wins. Anything still unset falls back to FIXBACK_SECRET_KEY, FIXBACK_API_URL, FIXBACK_RELEASE, and FIXBACK_SERVICE_NAME.

Program.cs
builder.WebHost.UseFixback(o =>{    o.Release = Environment.GetEnvironmentVariable("GIT_SHA"); // defaults to the assembly's version    o.InAppInclude.Add("Acme"); // namespaces that are your own code});

Release otherwise defaults to the entry assembly's informational version, which the .NET SDK stamps with the git commit when you build from a repository. To stay quiet in local development, turn capture off in that environment's settings:

appsettings.Development.json
{  "Fixback": {    "Enabled": false  }}

Manual capture

Report a handled exception or a message from anywhere in your app:

c#
using Fixback;try{    await ChargeAsync(order);}catch (Exception ex){    FixbackSdk.CaptureException(ex); // handled: true}FixbackSdk.CaptureMessage("cache miss storm", FixbackLevel.Warning);

Prefer dependency injection? Take an IFixbackClient instead of the static:

c#
public sealed class CheckoutService(IFixbackClient fixback){    public void Report(Exception ex) => fixback.CaptureException(ex);}

Logged errors

Errors you already log through ILogger reach Fixback with no extra code. A logged exception is filed as a handled error; a log line without one is filed as a message, grouped by its message template — so every order's failure is one Issue, not one per order:

c#
logger.LogError(ex, "Charging order {OrderId} failed", order.Id); // a handled errorlogger.LogError("Inventory sync stalled for {Warehouse}", warehouse); // a message, grouped by its template

The threshold is MinimumEventLevel — LogLevel.Error by default; LogLevel.None turns log capture off. An error logged during a request is filed when the request completes, with the status the response really got — so logging an exception and rethrowing it files one Issue, with the 500, and the log line kept on its Trace.

Serilog

UseSerilog() replaces the ILogger pipeline, so in a Serilog app the logging integration above sees nothing. Add Fixback's sink instead:

shell
dotnet add package Fixback.Serilog
Program.cs
var builder = WebApplication.CreateBuilder(args);builder.WebHost.UseFixback(); // the request: its context, Correlation id, and errorsbuilder.Host.UseSerilog((context, configuration) => configuration    .ReadFrom.Configuration(context.Configuration)    .Enrich.FromLogContext()    .WriteTo.Console()    .WriteTo.Fixback()); // what the app logs

The sink files through the client UseFixback() starts — read at each event, so a bootstrap logger configured before it exists is fine — and reads what you log exactly as the ILogger integration does: an error with an exception is a handled error, one without is a message grouped by its template, and the host's report of a faulted BackgroundService is filed as handled: false. Lower levels become breadcrumbs, with their logger and the properties the message does not already show — what BeginScope, LogContext and your enrichers added.

c#
.WriteTo.Fixback(    minimumEventLevel: LogEventLevel.Error,             // captured (the default)    minimumBreadcrumbLevel: LogEventLevel.Information)  // breadcrumbs (the default)

It works beside UseFixback() without filing anything twice. An error logged during a request waits for the request to complete, so it carries the request's route, status and Correlation id — and an exception the request then fails with is the same Issue. The line UseSerilogRequestLogging() writes for a failed request is left to the request integration too, so a failed request is one Issue, and that line — which carries the concrete path — is never a breadcrumb. A worker service registers the client with the logging integration, which starts it with the host, before any BackgroundService runs:

Program.cs
var builder = Host.CreateApplicationBuilder(args);builder.Logging.AddFixback(); // registers the client; the host starts itbuilder.Services.AddSerilog(configuration => configuration.WriteTo.Fixback());builder.Services.AddHostedService<Worker>();builder.Build().Run();

Inner exceptions

A captured exception brings the exceptions behind it: its InnerException, followed five deep, and an AggregateException's InnerExceptions, ten of one aggregate — at most ten in all, each with its own type, message and stack frames, scrubbed like the exception itself. The Issue shows them as Caused by sections under the error, and the Brief and the hand-off to your coding agent include them. The captured exception's message is its own, its inner exceptions' types join its fingerprint, and BeforeSend sees the chain as e.Causes.

An exception is filed once, even as part of another's chain. When EF Core logs the SqlException behind a failed save and the DbUpdateException wrapping it then escapes the request, the request files one Issue — the DbUpdateException's, with the SqlException under it.

Grouping

Repeats of one error fold into one Issue with a rising count, across every instance and build. An error's fingerprint is its type with its inner exceptions' types, and the top frames of your own code, by method and assembly and never by line. Async methods, lambdas and local functions count as the method you wrote. The message counts only when none of your frames are on the stack, with every number collapsed: Order 42 not found and Order 43 not found from one throw site are one Issue. A logged message groups by its template.

Group your own way with Fingerprint, on a capture's CaptureContext or in BeforeSend. e.ErrorSignature is the fingerprint the SDK computed, and Fingerprint wins over it:

c#
// "{{ default }}" is the fingerprint the SDK computed: split it by tenantFixbackSdk.CaptureException(ex, new CaptureContext { Fingerprint = ["{{ default }}", tenantId] });builder.WebHost.UseFixback(o =>{    o.BeforeSend = e =>    {        if (e.Exception is HttpRequestException) e.Fingerprint = ["payment-provider-down"];        return e;    };});

Fingerprints changed in version 2 of these rules. An Issue filed before you upgrade keeps folding: the SDK also sends the old key, and Fixback moves the Issue onto the new one the first time it sees both.

An error carries the lead-up of its own request, and the Issue's Trace tab lists it in order above the failing request: what it logged through ILogger at MinimumBreadcrumbLevel (Information by default) — the message, its category and the properties of its BeginScope scopes — and every outgoing HttpClient request: its method, its URL without the query string, its status, how long it took and how it ended. Never a header or a body, and never the SDK's own batches.

Each request records its own, so an error never carries another request's breadcrumbs; work outside a request records into one process-wide set. An error carries the newest MaxBreadcrumbs (50 by default) from the last five minutes. Requests are read from the HTTP handler's diagnostic events, so nothing is wrapped and no traceparent header is added; the hosting layer's own request lines, which carry the concrete path, are left out.

c#
builder.WebHost.UseFixback(o =>{    o.MaxBreadcrumbs = 30;                        // the newest 30 per error (default 50)    o.MinimumBreadcrumbLevel = LogLevel.Warning;  // default: Information    // See each breadcrumb as it is recorded: edit it, or drop it with null.    o.BeforeBreadcrumb = crumb => crumb.Url?.Contains("/health") == true ? null : crumb;});

Confirming the connection

The browser and Expo SDKs announce themselves the moment they load, so a Project with either installed flips to Connected on the next page view. A server has no equivalent moment — the .NET SDK sends nothing until it captures something — so the first capture is what confirms the install. Trigger one deliberately:

c#
using Fixback;FixbackSdk.CaptureException(new InvalidOperationException("Fixback test"));

or from a temporary endpoint that throws:

Program.cs
app.MapGet("/fixback-test", () =>{    throw new InvalidOperationException("Fixback test"); // remove it once the error arrives});

The Project's status flips as soon as that batch lands, and the error arrives in the queue as an Internal-tier Issue tagged platform: dotnet that you can resolve straight away. If nothing shows up, check that Enabled is not false in this environment and that the secret key has not been revoked — or set Debug to have the SDK say why on standard error.

Workers and console apps

Not an ASP.NET Core app? A Generic Host worker adds Fixback to its logging, from the Fixback.Extensions.Logging package — the same configuration, ILogger capture, and crash handlers, without the middleware:

Program.cs
var builder = Host.CreateApplicationBuilder(args);builder.Logging.AddFixback(); // the Fixback.Extensions.Logging packagebuilder.Services.AddHostedService<Worker>();builder.Build().Run();

Any other .NET app starts the client itself, and disposes it on the way out to send what is queued — one that never does is flushed as its process exits:

Program.cs
using Fixback;using var fixback = FixbackSdk.Init(o => o.SecretKey = Environment.GetEnvironmentVariable("FIXBACK_SECRET_KEY"));// … your program — disposing the handle sends what is queued …

Delivery

Errors buffer in memory and go to Fixback in batches — when 100 are queued, every 5 seconds (FlushInterval), on FlushAsync, and when the client is disposed. An error leaves the buffer only once Fixback has filed it:

  • Retried. A batch that fails — a 5xx, a timeout, Fixback unreachable — is kept and sent again after 10 seconds, then 20, 40, … up to 5 minutes between tries. An error is given up after 6 failed sends, about five minutes of an unreachable Fixback.
  • Rate limits honoured. When your environment's error budget is spent, Fixback files what it can and answers the rest rate_limited, or the whole batch 429, with a Retry-After. The SDK sends nothing until that wait is over, then sends those errors again; each wait counts as one of the 6 tries.
  • Nothing lost to a pause. Errors captured while the SDK waits keep buffering, and a repeat of one already queued folds into it — so occurrence counts still add up. The buffer holds MaxQueueSize distinct errors (1024): past that the oldest is dropped.
  • Never resent when it can't pass. An error Fixback could not read, or a batch refused outright (a 4xx other than 429), is dropped rather than retried.
  • Flushed on shutdown. Disposing the client — which ASP.NET Core and the Generic Host do when the host stops — sends what is queued, waiting at most ShutdownTimeout (2 seconds). An app that called FixbackSdk.Init and never disposed the handle is flushed the same way as its process exits — Main returning, Environment.Exit, or a SIGTERM, which still ends the process as it would have. A crash is flushed before the process goes down.

A secret key Fixback refuses (401: revoked, its environment deleted, or a publishable key) or a suspended workspace (403) is said once on standard error, so a misconfigured deploy is never silent. Debug says more: why the SDK is inert, what every send answered, and what is retried or given up.

Attaching a user and tags

The SDK never scrapes user identity. Attach an app-supplied reference and it rides along with what is captured in its scope, and shows on the Issue:

c#
FixbackSdk.SetUser(currentUser.Id); // an opaque ref you choose — not a name/email unless you send oneFixbackSdk.SetTag("tenant", currentTenant.Slug); // a key/value pair, shown on the Issue as a chip

Inside a request, both belong to that request. Outside one — a BackgroundService, a queue consumer, startup — they set process-wide values that every error carries, and that a request without its own value carries too. SetUser(null) clears the user; SetTag(key, null) removes a tag. A tag key is up to 32 letters, digits, _, ., : or -; a value up to 200 characters on one line; an error carries at most 50.

Where it ran

Every batch says which process sent it: the SDK's name and version (the Issue's SDK row), your ServiceName (or FIXBACK_SERVICE_NAME), and the machine name, .NET runtime and OS, read once when the client is built. So several services, or several instances of one, filing into one environment can be told apart on the Issue. A CaptureMessage level shows there too.

Stack traces, without source maps

A .NET error's frames carry file:line from your app's debug symbols — portable PDBs ship with dotnet publish by default — so there is nothing to upload: the source maps guide is for the JavaScript SDKs. Your own top frame becomes the Issue's code area: the file:line Fixback hands your coding agent. Strip the PDBs and errors still group, but arrive without file, line, or code area. An error groups by the top frames of your own code (see Grouping); InAppInclude and InAppExclude decide which namespaces count as yours.

The paths are the ones your build recorded, so by default they are the build machine's. Build with -p:ContinuousIntegrationBuild=true and they become repository-relative: /_/src/Api/Program.cs, which Fixback reads as src/Api/Program.cs. That needs the build to see the repository's .git; without it the paths stay absolute.

Privacy & fail-quiet

Private by default: the SDK captures the route pattern (/users/{id:int}, never the concrete path with values), method, status, a correlation id, the app-supplied user ref and tags, where the process runs (service, machine name, .NET runtime, OS), and the request's scrubbed breadcrumbs — never Authorization/Cookie headers, environment variables, or query values, and no request body unless you opt in with CaptureBodies — useful for debugging on staging. A BeforeSend hook redacts further or drops an event (return null). See Privacy & data.

And it fails quiet: if Fixback is unreachable or misconfigured, your app keeps running normally — observability never becomes an outage.