C# / .NET with AllStak
Add error tracking and request monitoring to your ASP.NET Core app with the AllStak NuGet package.
- Source repository:
- AllStak/allstak-dotnet
- Source README:
- README.md
- SDK version:
- 0.3.0
- Installation source:
- NuGet
- Last verified:
- 2026-05-31
Installation
Install from NuGet (targets net8.0 / net9.0).
dotnet add package AllStakConfiguration
Register AllStak in services and add the middleware.
using AllStak;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddAllStak(options =>
{
options.ApiKey = Environment.GetEnvironmentVariable("ALLSTAK_API_KEY");
options.Environment = builder.Environment.EnvironmentName;
options.Release = Environment.GetEnvironmentVariable("ALLSTAK_RELEASE");
options.ServiceName = "checkout-api";
});
var app = builder.Build();
app.UseAllStak();Basic example
Register app.UseAllStak() after UseExceptionHandler and before UseRouting/UseEndpoints.
Capturing errors
Capture handled exceptions via the Errors module. (The verified method is CaptureExceptionAsync; the README's Errors.Capture does not exist in source.)
await AllStakClient.Instance.Errors.CaptureExceptionAsync(
new InvalidOperationException("checkout failed"));Tracking requests
AllStakMiddleware (via app.UseAllStak()) captures inbound requests when CaptureHttpRequests is true (default); outbound HttpClient calls are auto-instrumented (InstrumentOutboundHttp), and EF Core via UseAllStak on the DbContext options.
Best practices
- Place UseAllStak() after UseExceptionHandler and before routing.
- Set ApiKey from an environment variable.
- Use CaptureExceptionAsync (not the README's Errors.Capture) for manual capture.