Skip to main content
There is no Squasher SDK for .NET. Use OpenTelemetry, the Sentry SDK for .NET, or the HTTP API. This page is tested with OpenTelemetry .NET 1.19 and the Sentry SDK 6.11 on .NET 10.

Send errors with OpenTelemetry

1

Add the packages

2

Register OpenTelemetry

Program.cs
UseOtlpExporter sends traces and ILogger logs. It reads its settings from the environment variables in the next step.
3

Set the exporter variables

The .NET exporter uses gRPC by default. To keep that default, set the endpoint to the Collector URL for your project on port 443 and set OTEL_EXPORTER_OTLP_PROTOCOL=grpc. You can also keep the endpoint above and use http/protobuf. OTLP requests do not need the project ID. To get a key, see Create an ingest key.
Automatic AI triage runs only on issues from the production environment, so set deployment.environment.name to production in production.

How errors become issues

  • An unhandled exception in a request. ASP.NET Core marks the server span as an error. Squasher makes an issue from the span, titled with the span name, for example GET /checkout. Kestrel also logs the exception at error level, which makes a second issue.
  • An ILogger log at error level. Squasher makes an issue titled with the message template, for example Checkout failed for order {OrderId}. The template values and the exception become attributes of the record.
For the log record, the issue page shows the stack trace from the exception.stacktrace attribute.

Use the Sentry SDK for .NET

If your app already uses the Sentry SDK, point its DSN at Squasher. Squasher reads the gzip envelopes that the SDK sends.
Program.cs
The DSN is https://<ingest key>@ingest.squasher.ai/1. The ingest key selects the project; the SDK needs a number at the end. Squasher keeps errors, traces, logs, metrics, and sessions from the SDK, so you can keep tracing on. See Sentry for what each item becomes.

Send errors with the HTTP API

This class posts one error to the ingest endpoint with HttpClient:
Squasher.cs
Call await Squasher.CaptureErrorAsync(e) where you catch an exception. stack is shown as the stack trace on the issue page. See the HTTP API for all fields.

Send a test error

Add an endpoint that throws, and open it once:
Program.cs
For the HTTP API, call Squasher.CaptureErrorAsync with the same exception. Then select Issues in the sidebar of your project. If the error does not appear, see Troubleshooting.

Give the setup to a coding agent

Copy this prompt into your coding agent to set up .NET the same way:

Next steps

OpenTelemetry

See which OTLP data Squasher accepts.

Move from Sentry

Move an app from Sentry to Squasher.

HTTP API

See every field of the ingest endpoint.

Troubleshooting

Find out why an event does not appear.