Innovabit.DotNet.Interceptors.Collections 2.0.105

There is a newer version of this package available.
See the version list below for details.
dotnet add package Innovabit.DotNet.Interceptors.Collections --version 2.0.105
                    
NuGet\Install-Package Innovabit.DotNet.Interceptors.Collections -Version 2.0.105
                    
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="Innovabit.DotNet.Interceptors.Collections" Version="2.0.105" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Innovabit.DotNet.Interceptors.Collections" Version="2.0.105" />
                    
Directory.Packages.props
<PackageReference Include="Innovabit.DotNet.Interceptors.Collections" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Innovabit.DotNet.Interceptors.Collections --version 2.0.105
                    
#r "nuget: Innovabit.DotNet.Interceptors.Collections, 2.0.105"
                    
#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.
#:package Innovabit.DotNet.Interceptors.Collections@2.0.105
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Innovabit.DotNet.Interceptors.Collections&version=2.0.105
                    
Install as a Cake Addin
#tool nuget:?package=Innovabit.DotNet.Interceptors.Collections&version=2.0.105
                    
Install as a Cake Tool

Innovabit.DotNet.Interceptors.Collections

A collection of ready-to-use interceptors for the Innovabit.DotNet.Interceptors suite. It provides retry-on-exception, timeout, circuit-breaker and fallback interceptors.

Install

dotnet add package Innovabit.DotNet.Interceptors.Collections

Retry on exception

Decorate a method with [RetryOnException] and it is retried when it throws.

using Innovabit.DotNet.Interceptors.Collections.Retries;

public class PaymentService : IPaymentService
{
    [RetryOnException(MaxFailures = 5, WaitMs = 200, ExceptionTypes = new[] { typeof(HttpRequestException) })]
    public Task ChargeAsync(Order order) { ... }
}

Register it from DI:

services.AddInterceptors()
    .AddRetry();

services.AddScopedWithInterception<IPaymentService, PaymentService>();

Options ([RetryOnException])

  • MaxFailures — maximum attempts (default 3, must be > 0).
  • WaitMs — delay between attempts in milliseconds (default 1000).
  • ExceptionTypes / ExceptionType — only retry for these exception types; when unset, any exception is retried.

Works with synchronous methods, Task and Task<T>. When all attempts fail the last exception is re-thrown preserving its original stack trace.

Timeout

Decorate a method with [Timeout(milliseconds)] and it fails with a TimeoutException when it runs longer than the limit.

using Innovabit.DotNet.Interceptors.Collections.Timeouts;

public class ReportService : IReportService
{
    [Timeout(5000)]
    public Task<Report> BuildAsync() { ... }
}

Register it from DI:

services.AddInterceptors()
    .AddTimeout();

services.AddScopedWithInterception<IReportService, ReportService>();

The timeout is enforced on Task/Task<T> and ValueTask/ValueTask<T>-returning methods; a synchronous method cannot be interrupted once running, so the timeout is a no-op there. [Timeout] bounds how long the caller waits — the timed-out call keeps running in the background, it is not cancelled.

Circuit breaker

Decorate a method with [CircuitBreaker] and it stops being called once it has failed repeatedly: further calls fail immediately with a CircuitBreakerOpenException instead of piling more load onto a dependency that is already down.

using Innovabit.DotNet.Interceptors.Collections.CircuitBreakers;

public class CatalogClient : ICatalogClient
{
    [CircuitBreaker(FailureThreshold = 5, DurationOfBreakMs = 30_000, ExceptionType = typeof(HttpRequestException))]
    public Task<Product> GetAsync(string sku) { ... }
}

Register it from DI:

services.AddInterceptors()
    .AddCircuitBreaker();

services.AddScopedWithInterception<ICatalogClient, CatalogClient>();

Options ([CircuitBreaker])

  • FailureThreshold — consecutive failures that open the circuit (default 5). A single success resets the count.
  • DurationOfBreakMs — how long the circuit stays open before a trial call is allowed through (default 30000).
  • SuccessThreshold — consecutive successful trial calls that close the circuit again (default 1).
  • ExceptionType — only these exceptions count as a failure; others are re-thrown without touching the circuit. When unset, every exception counts.

How it behaves

State What happens
Closed Calls go through; consecutive failures are counted.
Open Calls are rejected with CircuitBreakerOpenException (which carries RetryAfter) without reaching the method, until the break elapses.
HalfOpen Exactly one trial call at a time is let through. A success closes the circuit, a failure opens it again for another full break.

Circuits are tracked per method in a singleton CircuitBreakerRegistry — shared by every caller, because state that reset per request would never break anything. Inject the registry to inspect a circuit (GetState(MethodInfo)) from a health check, or reset them all with Reset(). Tests can drive time with AddCircuitBreaker(TimeProvider) instead of waiting out the break.

Put [CircuitBreaker] on the call that leaves your process, not on the orchestrating method above it. It runs at InterceptorOrders.CircuitBreaker (400), above retry (500), so an open circuit rejects the call before the retry loop spends its attempts on a dependency that is known to be down.

Fallback

Decorate a method with [Fallback(nameof(Other))] and a failure is answered by another method on the same class instead of reaching the caller: a cached figure instead of a live one, an empty list instead of an error, a second provider instead of the first.

using Innovabit.DotNet.Interceptors.Collections.Fallbacks;

public class QuoteClient : IQuoteClient
{
    [Fallback(nameof(GetCachedAsync), ExceptionType = typeof(HttpRequestException))]
    public Task<Quote> GetAsync(string symbol) => _api.FetchAsync(symbol);

    public Task<Quote> GetCachedAsync(string symbol) => Task.FromResult(_lastKnown[symbol]);
}

Register it from DI:

services.AddInterceptors()
    .AddFallback();

services.AddScopedWithInterception<IQuoteClient, QuoteClient>();

Options ([Fallback])

  • Method — name of the alternative, on the same class, taking the same parameters and returning a compatible type. Use nameof so a rename cannot break it.
  • ExceptionType — only fall back for these failures. When unset, every exception falls back.

Set ExceptionType to the one failure you actually have an answer for. Falling back on any exception is how a broken method turns into one that quietly returns the wrong thing.

How it behaves

The alternative is invoked directly on the target, not through the proxy, so it is not itself intercepted — that is what stops a failing fallback from falling back to itself forever, retrying itself, or counting against the same circuit. If the alternative throws, its exception is what the caller sees: there was nothing left to try.

Misconfiguration fails loudly rather than at the worst possible moment: a name that matches no method, a signature that does not line up, a return type that cannot stand in, or a fallback pointing at itself all throw on the first call with a message saying which.

It runs at InterceptorOrders.Fallback (350) — outside the circuit breaker (400), because an open circuit is exactly when a fallback earns its keep, and inside notifications (300), so a failure it handled does not page anyone.

Part of

The Innovabit.DotNet.Interceptors suite — github.com/Innovabit/dotnet-interceptors.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Innovabit.DotNet.Interceptors.Collections:

Package Downloads
Innovabit.DotNet.Interceptors.All

Meta-package: every interceptor concern in the suite (logging, validation, caching, notifications, telemetry, audit, authorization, rate limiting, coordination, feature gates, transactions, retry/timeout/circuit breaker/fallback) in one reference. Providers are separate packages — pick the ones you use.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.119 54 11/14/2026
2.0.118 122 11/7/2026
2.0.117 139 10/31/2026
2.0.116 124 10/26/2026
2.0.115 131 10/17/2026
2.0.114 137 10/10/2026
2.0.113 139 10/3/2026
2.0.112 141 9/28/2026
2.0.111 118 9/28/2026
2.0.110 122 9/27/2026
2.0.109 117 9/26/2026
2.0.108 120 9/26/2026
2.0.107 127 9/26/2026
2.0.106 128 9/25/2026
2.0.105 126 9/25/2026
1.0.0.104 121 9/25/2026
1.0.0.103 106 9/25/2026
1.0.0.102 103 9/25/2026
1.0.0.101 103 9/25/2026
1.0.0.100 106 9/25/2026
Loading failed