API reference

.NET SDK reference

The complete API of the .NET SDK. For a narrative walkthrough, see the ASP.NET Core & .NET guide.

Packages

Four NuGet packages, each for .NET 8 and .NET 10, all on one version. Install the one for your app; it brings what it needs.

PackageDescription
Fixback.AspNetCoreThe ASP.NET Core integration: UseFixback and the request middleware. Depends on the next two.
Fixback.Extensions.LoggingILogger capture and the Generic Host: builder.Logging.AddFixback().
FixbackThe core client — FixbackSdk, IFixbackClient, the transport. No dependencies.
Fixback.SerilogThe Serilog sink: WriteTo.Fixback(). Depends on Fixback and Serilog; installed beside one of the above.

Registering

Program.cs
// ASP.NET Core — the middleware, ILogger capture, and the crash handlers:var builder = WebApplication.CreateBuilder(args);builder.WebHost.UseFixback();// …with options set in code, after configuration:builder.WebHost.UseFixback(o =>{    o.Release = "1.4.2";    o.CaptureBodies = true;});

UseFixback adds the request middleware for you, at the very start of the pipeline (there is no app.Use… line), plus ILogger capture and the process-level crash handlers. Outside ASP.NET Core:

c#
// A Generic Host worker (Fixback.Extensions.Logging) — ILogger capture and the crash handlers:builder.Logging.AddFixback();// Any other .NET app (Fixback) — dispose the handle on the way out to send what is queued:using var fixback = FixbackSdk.Init(o => o.SecretKey = Environment.GetEnvironmentVariable("FIXBACK_SECRET_KEY"));

Configuration

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

appsettings.json
{  "Fixback": {    "Release": "1.4.2",    "MinimumEventLevel": "Warning",    "CaptureBodies": true  }}

Keep the secret key out of it: appsettings.json is committed, the key never is.

Options

FixbackAspNetCoreOptions. Every one can be set in configuration or in the callback.

OptionTypeDescription
SecretKeystringRequired. A secret key (sk_…) of the environment this app runs as — its errors land in that environment, so there is no environment option. Falls back to FIXBACK_SECRET_KEY. Server-side only; without one the SDK is inert.
ApiUrlstringThe Fixback API origin. Falls back to FIXBACK_API_URL, then to https://api.fixback.dev. Override for a self-hosted deployment.
ReleasestringThe build identifier. Falls back to FIXBACK_RELEASE, then to the entry assembly's informational version — which the .NET SDK stamps with the git commit when you build from a repository. 1–100 visible characters with no whitespace or slashes; an unusable one is dropped with a warning.
ServiceNamestringWhich service this process is (checkout-api), shown on every Issue it files so several services in one environment can be told apart. Falls back to FIXBACK_SERVICE_NAME. Up to 128 characters on one line; an unusable one is ignored with a warning.
EnabledboolGate capture on or off — e.g. false in appsettings.Development.json to stay quiet in local dev. Defaults to true.
ScrubboolRun the built-in PII scrubbers before BeforeSend. Defaults to true.
BeforeSendFunc<FixbackErrorEvent, FixbackErrorEvent?>Redact fields, or drop an event entirely by returning null. e.Exception is the original exception. Set e.Fingerprint to group it your own way ("{{ default }}" stands for e.ErrorSignature, the fingerprint the SDK computed); a capture's CaptureContext.Fingerprint arrives there — see Grouping.
AutoCaptureboolThe umbrella for the two process handlers below. Defaults to true; false installs neither.
CaptureUnhandledExceptionsbool?Capture AppDomain.UnhandledException — a crash — as handled: false. Defaults to AutoCapture.
CaptureUnobservedTaskExceptionsbool?Capture unobserved task exceptions as handled: false. Defaults to AutoCapture.
InAppInclude / InAppExcludeIList<string>Namespace prefixes that are your own code, or library code beside the built-in list (System, Microsoft, common libraries). An error groups by the top frames of your own code, so these decide how it groups.
MinimumEventLevelLogLevelThe lowest ILogger level captured. Defaults to LogLevel.Error; LogLevel.None turns log capture off.
MinimumBreadcrumbLevelLogLevelThe lowest ILogger level recorded as a breadcrumb, with its category and scope properties. Defaults to LogLevel.Information. A captured entry is recorded too.
MaxBreadcrumbsintThe most breadcrumbs one error carries — the newest of its request's log lines and outgoing HttpClient requests. Defaults to 50; at most 100; 0 records none.
BeforeBreadcrumbFunc<Breadcrumb, Breadcrumb?>See each breadcrumb as it is recorded: edit it, or drop it by returning null. A hook that throws keeps the breadcrumb.
CaptureHttpBreadcrumbsboolRecord each outgoing HttpClient request — method, URL without its query string, status, duration and outcome; never a header or a body. Defaults to true.
RequestIdHeaderstringThe header a request's Correlation id is read from when it carries no traceparent. Defaults to x-request-id.
CaptureBodiesboolAttach the failing request's body to its errors — text-like content types only — so the server Issue's request row shows the payload that failed. Defaults to false — an opt-in, useful for debugging on staging. The built-in scrubbers redact PII from it before it leaves the process, and Fixback redacts it again on arrival.
MaxBodyBytesintThe body cap, in bytes, under CaptureBodies: a bigger body is dropped whole, never cut short. Defaults to 16384; at most 65536.
DebugboolWrite the SDK's own diagnostics — why it is inert, what every send answered, what is retried or given up — to standard error. A refused secret key (401) or a suspended workspace (403) is said once either way.
c#
builder.WebHost.UseFixback(o =>{    o.BeforeSend = e => e.Exception is TaskCanceledException ? null : e; // null drops the event});

Transport tuning

Sensible by default; reach for these only when your traffic shape asks for it.

OptionDefaultDescription
MaxBatchSize100Flush once the buffer reaches this many errors. Capped at the server's limit of 500.
FlushInterval5 secondsFlush a non-empty buffer at least this often.
MaxQueueSize1024The most distinct errors held in memory — while Fixback is unreachable or asks the SDK to wait, too. A repeat of a held error folds into it; a new one past the bound drops the oldest.
Timeout30 secondsPer-request transport timeout. A request that times out is retried.
ShutdownTimeout2 secondsHow long a shutdown — the host stopping, the handle disposed, the process exiting, or a crash — waits to send what is queued.

The transport batches errors on the secret-key door and keeps each until Fixback has filed it — retrying a failed send, honouring Retry-After, and sending what is queued when the app shuts down or its process exits (see Delivery). Each error carries the instant it was captured, so a batch flushed seconds later still records when every error happened.

Capture API

The static FixbackSdk (namespace Fixback) forwards to the active client and is a no-op before one exists, so library code can call it unconditionally. Prefer dependency injection? IFixbackClient carries the same capture methods.

c#
using Fixback;FixbackSdk.CaptureException(ex);FixbackSdk.CaptureMessage("cache miss storm", FixbackLevel.Warning);FixbackSdk.SetUser(currentUser.Id);FixbackSdk.SetTag("tenant", currentTenant.Slug);await FixbackSdk.FlushAsync();
MethodDescription
CaptureException(ex)Report a handled exception (handled: true).
CaptureMessage(message, level?)Report a message with a FixbackLevel — Debug, Info (the default), Warning, Error, or Fatal — shown on the Issue.
SetUser(ref)Attach an app-supplied, opaque user reference (up to 256 characters) to the errors captured in the current request — or, outside a request, to every error, as the process-wide user. null clears it.
SetTag(key, value)Set a tag on the current request — or process-wide outside one; a request's value wins. A key is up to 32 letters, digits, _, ., : or -; a value up to 200 characters on one line; at most 50 per error. null removes it.
FlushAsync(timeout?)Send what is queued now. Never faults.
Init(o => …)Start a client yourself, outside ASP.NET Core and the Generic Host. Returns a handle; dispose it to send what is queued.

Serilog sink

WriteTo.Fixback() (namespace Serilog, package Fixback.Serilog) files what an app logs through Serilog — whose UseSerilog() replaces the ILogger pipeline the logging integration reads. It reads an event as that integration reads an entry, so an app files the same Issues either way.

c#
using Serilog;using Serilog.Events;// Through the SDK's active client (UseFixback, Logging.AddFixback or FixbackSdk.Init started it):configuration.WriteTo.Fixback();configuration.WriteTo.Fixback(minimumEventLevel: LogEventLevel.Warning, minimumBreadcrumbLevel: LogEventLevel.Debug);// Through a client of your own:configuration.WriteTo.Fixback(services.GetRequiredService<IFixbackClient>());
ArgumentDefaultDescription
minimumEventLevelErrorThe lowest level captured: an exception as a handled error (the host's report of a faulted BackgroundService as handled: false), a line without one as a message grouped by its template.
minimumBreadcrumbLevelInformationThe lowest level recorded as a breadcrumb: the level, rendered message, logger (SourceContext), and the properties the message does not show — at most 20, each up to 200 characters. A captured event is recorded too.
clientthe active clientThe IFixbackClient to file through. Without it, the SDK's active client is read at each event, and an event before one exists is skipped.

During a request an error waits for the request to complete, so it records the real status, and an exception the request then fails with is one Issue. ASP.NET Core's unhandled-exception lines and UseSerilogRequestLogging()'s line for a failed request are left to UseFixback(), which files the request's error itself; that line is never a breadcrumb. The sink runs on the logging call's thread, so it must not be wrapped in WriteTo.Async(…). It can also be configured from Serilog.Settings.Configuration:

appsettings.json
{  "Serilog": {    "Using": ["Fixback.Serilog"],    "WriteTo": [{ "Name": "Fixback", "Args": { "minimumEventLevel": "Error", "minimumBreadcrumbLevel": "Information" } }]  }}

What is captured

  • Request errors — an exception that escapes the pipeline, one UseExceptionHandler or an IExceptionHandler handled, and the developer exception page's — filed as handled: true, with the route pattern (/users/{id:int}, never the concrete path), the method, and the status. A request the client aborted is not captured.
  • Logged errors — through ILogger, at MinimumEventLevel or above, or through Serilog's sink: a logged exception as a handled error, a log line without one as a message grouped by its message template.
  • Faulted background services — a BackgroundService whose ExecuteAsync threw, which the host reports through its log, as handled: false.
  • Crashes — AppDomain.UnhandledException and unobserved task exceptions, as handled: false.

Every error arrives Internal tier, tagged platform: dotnet, in the environment of its secret key. Its frames carry file:line from the app's PDBs — portable PDBs ship with dotnet publish by default — so no source maps are involved.

It also says where it ran: every batch carries the SDK's name and version, the ServiceName, and the machine name, .NET runtime and OS, read once when the client is built — with the app-supplied user and tags of the scope it was captured in.

The Correlation id

The middleware gives every request one id, and errors captured during the request carry it. It takes the first source that has one:

  1. the trace id of an inbound W3C traceparent header — what the browser SDK sends on your page's same-origin requests and to the origins listed in its propagateTo, and what the Expo SDK sends to the origins listed in its own;
  2. the RequestIdHeader — x-request-id unless you configured another;
  3. the trace id of the request's Activity;
  4. a freshly minted id.

When the page's request carried the id, the server Issue's request row and the browser Issue's network row show the same Correlation id, and the server Issue lists the page Issues it was seen from — with their replay — while each of those names it as the server error behind its request.