Pidget.AspNet 1.1.0

dotnet add package Pidget.AspNet --version 1.1.0
NuGet\Install-Package Pidget.AspNet -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pidget.AspNet" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pidget.AspNet --version 1.1.0
#r "nuget: Pidget.AspNet, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Pidget.AspNet as a Cake Addin
#addin nuget:?package=Pidget.AspNet&version=1.1.0

// Install Pidget.AspNet as a Cake Tool
#tool nuget:?package=Pidget.AspNet&version=1.1.0

Usage

After setup, exceptions thrown inside the application are automatically captured and sent to Sentry.

Setup

In Startup.cs add the Pidget.AspNet.Setup namespace to your usings.

using Pidget.AspNet.Setup;

In the ConfigureServices method, configure your DSN using the AddPidgetMiddleware extension method.

public void ConfigureServices(IServiceCollection services)
{
    // ...

    services.AddPidgetMiddleware(o => o.Dsn = "<YOUR_DSN>");

In the Configure method in Startup.cs, configure your application to use the pidget error reporting middleware. Make sure you add the Pidget middleware before your application code, like in the below example (using MVC).

public void Configure(IApplicationBuilder app)
{
    // ...

    app.UsePidgetMiddleware();
    app.UseMvc();

See also: Startup.cs in Pidget.AspNetExample

Configuring callbacks

Callbacks for before and- after send, can be configured with both setup options.

Using configuration:

service.AddPidgetMiddleware(config.GetSection("Sentry"), callbacks =>
{
    callbacks.BeforeSendAsync(async (builder, http) => /* ... */);
    callbacks.AfterSendAsync(async (response, http) => /* ... */));
});

Or by using a setup-action:

service.AddPidgetMiddleware(sentry =>
{
    sentry.Dsn = "YOUR_DSN";
    sentry.Callbacks.BeforeSendAsync(async (builder, http) => /* ... */);
    sentry.Callbacks.AfterSendAsync(async (response, http) => /* ... */));
});

Note: The after-send callback might return a response of null, if rate-limiting has occurred.

Combining with other error handlers or middleware

The middleware is designed to be unintrusive. Any exceptions caught by the middleware will be re-thrown after being captured. No special considerations have to be made when combining this middleware with others. However; the order your middleware are configured in may effect which errors are reported, for instance: If the pidget error reporting middleware invokes middleware which suppresses an exception, that exception will not be caught. As such, is it wise to configure your application pipeline to have the pidget exception reporting middleware invoke your application code (see the graph below) and in the example application.

request pipeline

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 1,325 10/2/2018
1.0.3 1,040 3/10/2018
1.0.2 903 2/28/2018
0.3.0 1,114 11/19/2017
0.2.1 1,118 11/15/2017