Pidget.AspNet
1.0.3
See the version list below for details.
dotnet add package Pidget.AspNet --version 1.0.3
NuGet\Install-Package Pidget.AspNet -Version 1.0.3
<PackageReference Include="Pidget.AspNet" Version="1.0.3" />
paket add Pidget.AspNet --version 1.0.3
#r "nuget: Pidget.AspNet, 1.0.3"
// Install Pidget.AspNet as a Cake Addin #addin nuget:?package=Pidget.AspNet&version=1.0.3 // Install Pidget.AspNet as a Cake Tool #tool nuget:?package=Pidget.AspNet&version=1.0.3
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 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.
Product | Versions 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. |
-
.NETStandard 2.0
- Microsoft.AspNetCore.Http (>= 2.0.0)
- Microsoft.Extensions.Configuration (>= 2.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 2.0.0)
- Pidget.Client (>= 1.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.