Skip to main content
The fallback strategy provides an alternative value or action when an operation fails.

FallbackStrategyOptions

Configures the fallback resilience strategy.

Properties

Func<FallbackPredicateArguments<TResult>, ValueTask<bool>>
required
A predicate that determines whether the fallback should be executed for a given outcome.Default: Falls back on any exception except OperationCanceledException.
Func<FallbackActionArguments<TResult>, ValueTask<Outcome<TResult>>>
required
The fallback action to execute when the ShouldHandle predicate evaluates to true.This property is required and must be set.
Func<OnFallbackArguments<TResult>, ValueTask>?
default:"null"
An event delegate raised when a fallback happens.

Extension Methods

Add fallback strategies to a resilience pipeline:

Usage Examples

Simple Fallback Value

Fallback with Alternative Action

Conditional Fallback Based on Result

FallbackActionArguments

Arguments passed to the FallbackAction delegate.

Outcome

The Outcome<TResult> type represents either a successful result or an exception: