API reference
.NET SDK reference
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.
| Package | Description |
|---|---|
Fixback.AspNetCore | The ASP.NET Core integration: UseFixback and the request middleware. Depends on the next two. |
Fixback.Extensions.Logging | ILogger capture and the Generic Host: builder.Logging.AddFixback(). |
Fixback | The core client — FixbackSdk, IFixbackClient, the transport. No dependencies. |
Fixback.Serilog | The Serilog sink: WriteTo.Fixback(). Depends on Fixback and Serilog; installed beside one of the above. |
Registering
// 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:
// 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.
{ "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.
| Option | Type | Description |
|---|---|---|
SecretKey | string | Required. 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. |
ApiUrl | string | The Fixback API origin. Falls back to FIXBACK_API_URL, then to https://api.fixback.dev. Override for a self-hosted deployment. |
Release | string | The 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. |
ServiceName | string | Which 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. |
Enabled | bool | Gate capture on or off — e.g. false in appsettings.Development.json to stay quiet in local dev. Defaults to true. |
Scrub | bool | Run the built-in PII scrubbers before BeforeSend. Defaults to true. |
BeforeSend | Func<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. |
AutoCapture | bool | The umbrella for the two process handlers below. Defaults to true; false installs neither. |
CaptureUnhandledExceptions | bool? | Capture AppDomain.UnhandledException — a crash — as handled: false. Defaults to AutoCapture. |
CaptureUnobservedTaskExceptions | bool? | Capture unobserved task exceptions as handled: false. Defaults to AutoCapture. |
InAppInclude / InAppExclude | IList<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. |
MinimumEventLevel | LogLevel | The lowest ILogger level captured. Defaults to LogLevel.Error; LogLevel.None turns log capture off. |
MinimumBreadcrumbLevel | LogLevel | The lowest ILogger level recorded as a breadcrumb, with its category and scope properties. Defaults to LogLevel.Information. A captured entry is recorded too. |
MaxBreadcrumbs | int | The 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. |
BeforeBreadcrumb | Func<Breadcrumb, Breadcrumb?> | See each breadcrumb as it is recorded: edit it, or drop it by returning null. A hook that throws keeps the breadcrumb. |
CaptureHttpBreadcrumbs | bool | Record each outgoing HttpClient request — method, URL without its query string, status, duration and outcome; never a header or a body. Defaults to true. |
RequestIdHeader | string | The header a request's Correlation id is read from when it carries no traceparent. Defaults to x-request-id. |
CaptureBodies | bool | Attach 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. |
MaxBodyBytes | int | The body cap, in bytes, under CaptureBodies: a bigger body is dropped whole, never cut short. Defaults to 16384; at most 65536. |
Debug | bool | Write 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. |
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.
| Option | Default | Description |
|---|---|---|
MaxBatchSize | 100 | Flush once the buffer reaches this many errors. Capped at the server's limit of 500. |
FlushInterval | 5 seconds | Flush a non-empty buffer at least this often. |
MaxQueueSize | 1024 | The 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. |
Timeout | 30 seconds | Per-request transport timeout. A request that times out is retried. |
ShutdownTimeout | 2 seconds | How 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.
using Fixback;FixbackSdk.CaptureException(ex);FixbackSdk.CaptureMessage("cache miss storm", FixbackLevel.Warning);FixbackSdk.SetUser(currentUser.Id);FixbackSdk.SetTag("tenant", currentTenant.Slug);await FixbackSdk.FlushAsync();| Method | Description |
|---|---|
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.
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>());| Argument | Default | Description |
|---|---|---|
minimumEventLevel | Error | The 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. |
minimumBreadcrumbLevel | Information | The 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. |
client | the active client | The 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:
{ "Serilog": { "Using": ["Fixback.Serilog"], "WriteTo": [{ "Name": "Fixback", "Args": { "minimumEventLevel": "Error", "minimumBreadcrumbLevel": "Information" } }] }}What is captured
- Request errors — an exception that escapes the pipeline, one
UseExceptionHandleror anIExceptionHandlerhandled, and the developer exception page's — filed ashandled: 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, atMinimumEventLevelor 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
BackgroundServicewhoseExecuteAsyncthrew, which the host reports through its log, ashandled: false. - Crashes —
AppDomain.UnhandledExceptionand unobserved task exceptions, ashandled: 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:
- the trace id of an inbound W3C
traceparentheader — what the browser SDK sends on your page's same-origin requests and to the origins listed in itspropagateTo, and what the Expo SDK sends to the origins listed in its own; - the
RequestIdHeader—x-request-idunless you configured another; - the trace id of the request's
Activity; - 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.