Skip to content

Releases: kolan72/PoliNorError

2.24.20

24 Dec 15:21

Choose a tag to compare

Improvements

  • Eliminated closure allocations across all Fallback, Retry, and Execute policy processor methods by introducing internal/private overloads that accept the original Action<TParam>, Func<TParam, T>, Func<TParam, CancellationToken, Task> and Func<TParam, CancellationToken, Task<T>> delegates directly.
    Applied these optimizations consistently to:
    • DefaultRetryProcessor (sync and async variants, with and without RetryDelay / RetryCountInfo)
    • DefaultFallbackProcessor (sync and async variants)
    • SimplePolicyProcessor (sync and async execution paths)
  • Add DefaultRetryProcessor async method overloads with required CancellationToken parameter (no configureAwait), delegating to existing methods with configureAwait set to false:
    • RetryAsync<TParam> and RetryAsync<TParam, T> (with and without RetryDelay)
    • RetryInfiniteAsync<TParam> and RetryInfiniteAsync<TParam, T> (with and without RetryDelay)
    • RetryWithErrorContextAsync<TErrorContext> and RetryWithErrorContextAsync<TErrorContext, T> (with and without RetryDelay)
    • RetryInfiniteWithErrorContextAsync<TErrorContext> and RetryInfiniteWithErrorContextAsync<TErrorContext, T> (with and without RetryDelay)
  • Add DefaultFallbackProcessor async method overloads with required CancellationToken parameter (no configureAwait), delegating to existing methods with configureAwait set to false:
    • FallbackAsync<TErrorContext> and FallbackAsync<TErrorContext, T>
    • FallbackAsync<TParam> and FallbackAsync<TParam, T>
  • Add SimplePolicyProcessor async method overloads with required CancellationToken parameter (no configureAwait), delegating to existing methods with configureAwait set to false:
    • ExecuteAsync<TErrorContext> and ExecuteAsync<TErrorContext, T>
    • ExecuteAsync<TParam> and ExecuteAsync<TParam, T>
  • Introduce abstract ErrorProcessor<TParam> with an overridable Execute method for parameter-aware error processing.
  • Introduce void Policy.AddHandlerForPolicyResult extension method overloads.
  • Introduce an internal PolicyResult.SetCanceledEarly method to mark NoError as true on early cancellation and apply it to all core Retry, Fallback, and Simple policy processor methods.

Small changes

  • Convert SimplePolicyProcessor.AddErrorAndCatchBlockFilterError from a private method to an extension method on the PolicyResult class.
  • Add internal PolicyResult.ToLastPolicyResultState extension method and refactor to use LastPolicyResultState class.
  • Refactor PolicyProcessor.ExceptionFilter by extracting its logic into a new internal ExceptionFilterSet class.
  • DRY refactor ConstantRetryDelay.
  • DRY refactor ExponentialRetryDelay.
  • DRY refactor LinearRetryDelay.
  • DRY refactor TimeSeriesRetryDelay.
  • DRY refactoring of all internal IPolicyProcessor.WithErrorContextProcessorOf<T, TErrorContext> extension methods to unify shared logic across their various Action<Exception, ProcessingErrorInfo<TErrorContext>> overloads.
  • DRY refactoring of all internal IPolicyProcessor.WithErrorContextProcessorOf<T, TErrorContext> extension methods to unify shared logic across their various Func<Exception, ProcessingErrorInfo<TErrorContext>, Task> overloads.
  • Refactor PolicyDelegateCollectionResultBase internal constructor and add new tests for PolicyDelegateCollectionResult.
  • Mark PolicyResult.ChangeByRetryDelayResult as obsolete.
  • Rename DefaultRetryProcessor.RetryOverloads.cs file to DefaultRetryProcessor.RetryOverloads.RetryDelay.cs.
  • Move all DefaultRetryProcessor.Retry... methods that take an int retryCount parameter into DefaultRetryProcessor.RetryOverloads.LimitedRetries.cs.
  • Move all DefaultRetryProcessor.Retry… methods with RetryDelay and int retryCount parameters into DefaultRetryProcessor.RetryOverloads.RetryDelay.LimitedRetries.cs.
  • Move all DefaultRetryProcessor methods that use ConfigureAwait(false) into the new files DefaultRetryProcessor.RetryAsync.ConfigureAwaitFalse.cs and DefaultRetryProcessor.RetryDelay.RetryAsync.ConfigureAwaitFalse.cs
  • Move non-interface DefaultRetryProcessor Retry(Async) methods to DefaultRetryProcessor.RetryOverloads.cs.
  • Add new tests for RetryCountInfo.

Docs changes

  • Update XML documentation for ErrorProcessor.Process and ErrorProcessor.ProcessAsync to clarify that both methods directly call Execute.
  • Add PolicyResult.WrappedStatus checks to existing tests.
  • Edit 'Error processors' README Chapter.
  • Edit 'Retry-Then-Fallback' README chapter.
  • Update PolicyResult README Chapter.
  • Add THIRD-PARTY-NOTICES.

2.24.12

21 Sep 13:15

Choose a tag to compare

Improvements

  • Introduced the PolicyResult.WrappedStatus property and the enum-like WrappedPolicyStatus class, which encapsulate wrapped policy status values.
  • Introduced the SimplePolicy.ThenFallback method.
  • Introduced Policy.AddHandlerForPolicyResult extension methods in the new PoliNorError.Extensions.PolicyResultHandling namespace.
  • Introduce abstract ErrorProcessor class with Execute method that implementors must override to define error processing logic.
  • Support cancellation via linked token in FallbackPolicy.HandleAsync and DefaultFallbackProcessor.FallbackAsync overloads.
  • Support cancellation via linked token in FallbackPolicy.Handle and DefaultFallbackProcessor.Fallback overloads.
  • Support cancellation via linked token in FallbackPolicy.Handle<T> and DefaultFallbackProcessor.Fallback<T> overloads.
  • Support cancellation via linked token in FallbackPolicy.HandleAsync<T> and DefaultFallbackProcessor.FallbackAsync<T> overloads.
  • Support cancellation via linked token in SimplePolicy.HandleAsync and SimplePolicyProcessor.ExecuteAsync overloads.
  • Support cancellation via linked token in SimplePolicy.Handle and SimplePolicyProcessor.Execute overloads.
  • Support cancellation via linked token in SimplePolicy.Handle<T> and SimplePolicyProcessor.Execute<T> overloads.
  • Support cancellation via linked token in SimplePolicy.HandleAsync<T> and SimplePolicyProcessor.ExecuteAsync<T> overloads.
  • Support cancellation via linked token in RetryPolicy.HandleAsync and DefaultRetryProcessor.RetryAsync overloads.
  • Support cancellation via linked token in RetryPolicy.Handle and DefaultRetryProcessor.Retry overloads.
  • Support cancellation via linked token in RetryPolicy.Handle<T> and DefaultRetryProcessor.Retry<T> overloads.
  • Support cancellation via linked token in RetryPolicy.HandleAsync<T> and DefaultRetryProcessor.RetryAsync<T> overloads.
  • Support cancellation via linked token in the BulkErrorProcessor.ProcessAsync method.
  • Support cancellation via linked token in the BulkErrorProcessor.Process method.
  • Add early return in BulkErrorProcessor.Process foreach loop when cancellation occurs while processing the current error processor.
  • Supported cancellation via a linked token in the internal IDelayProvider.BackoffSafelyAsync extension method.
  • Supported cancellation via a linked token in the internal IDelayProvider.BackoffSafely extension method.
  • Introduced internal IDelayProvider.DelayAndCheckIfResultFailed extension method to replace the IDelayProvider.BackoffSafely method.
  • Introduced internal IDelayProvider.DelayAndCheckIfResultFailedAsyc extension method to replace the IDelayProvider.BackoffSafelyAsync method.
  • DRY refactoring of exception handling in SimplePolicyProcessor.ExecuteAsync and SimplePolicyProcessor.ExecuteAsync<T> via internal SimpleAsyncExceptionHandler class.
  • DRY refactoring of exception handling in SimplePolicyProcessor.Execute and SimplePolicyProcessor.Execute<T> via internal SimpleSyncExceptionHandler class.
  • DRY refactoring of exception handling in DefaultFallbackProcessor.Fallback and DefaultFallbackProcessor.Fallback<T> via internal SimpleSyncExceptionHandler class.
  • DRY refactoring of exception handling in DefaultFallbackProcessor.FallbackAsync and DefaultFallbackProcessor.FallbackAsync<T> via internal SimpleAsyncExceptionHandler class.
  • Refactor exception handling in DefaultFallbackProcessor.Fallback catch block to mark the result as canceled only when the passed or linked token is canceled.
  • Refactor exception handling in DefaultFallbackProcessor.FallbackAsync catch block to mark the result as canceled only when the passed or linked token is canceled.
  • Refactor exception handling in DefaultFallbackProcessor.Fallback<T> catch block to mark the result as canceled only when the passed or linked token is canceled.
  • Refactor exception handling in DefaultFallbackProcessor.FallbackAsync<T> catch block to mark the result as canceled only when the passed or linked token is canceled.
  • Ensure DefaultFallbackProcessor.FallbackAsync<T> returns FallbackFuncExecResult<T> with result on success path (test correction).
  • Introduced internal IDelayProvider.DelayAndCheckIfResultFailed extension method to replace the IDelayProvider.BackoffSafely method.
  • Introduced internal IDelayProvider.DelayAndCheckIfResultFailedAsyc extension method to replace the IDelayProvider.BackoffSafelyAsync method.
  • Reduce allocations and GC load on each retry by using the IDelayProvider.DelayAndCheckIfResultFailed method (stop using BasicResult class in retry processing).
  • Allows combining DelayErrorProcessor with error processors that support context.

Small changes

  • Support safe enumeration of the library-internal collection FlexSyncEnumerable<T> when accessed asynchronously.
  • Remove the extra check from the internal PolicyResult.ChangeByHandleCatchBlockResult extension method and rename it to WasResultSetToFailureByCatchBlock.
  • Mark IDelayProvider.BackoffSafely and IDelayProvider.BackoffSafelyAsync as obsolete.
  • Add CatchBlockException to PolicyResult<T>.CatchBlockErrors when cancellation occurs in generic fallback function.
  • Add CatchBlockException to PolicyResult.CatchBlockErrors when cancellation occurs in fallback function.
  • Add test to verify PolicyResult<T>.CatchBlockErrors contains exception when generic fallback function throws.
  • Add test to verify PolicyResult.CatchBlockErrors contains exception when fallback function throws.
  • Moved linked token cancellation tests into a single CancellationTests file.

Docs changes

  • Add XML summary comments for BulkErrorProcessor.
  • Add 'Retry-Then-Fallback' README Chapter.

Bumps and Dependency updates

  • Update NUnit NuGet package to v4.4.0.

2.24.0

07 Jul 12:15

Choose a tag to compare

Improvements

  • Introduced the RetryPolicy.ThenFallback method that implements the retry-then-fallback pattern.
  • Introduced the PolicyResult.PolicyCanceledError property, which stores the OperationCanceledException when cancellation occurs.
  • Fix issue #150.
  • Introduced TimeSeriesRetryDelay class
  • Introduced the TimeSeriesRetryDelayOptions class and added TimeSeries to the RetryDelayType enum.
  • Made DefaultFallbackProcessor implement the ICanAddErrorFilter<DefaultFallbackProcessor> interface.
  • Made FallbackPolicyBase implement the ICanAddErrorFilter<FallbackPolicyBase> interface.
  • Made FallbackPolicy implement the ICanAddErrorFilter<FallbackPolicy> interface.
  • Made FallbackPolicyWithAsyncFunc implement the ICanAddErrorFilter<FallbackPolicyWithAsyncFunc> interface.
  • Made FallbackPolicyWithAction implement the ICanAddErrorFilter<FallbackPolicyWithAction> interface.
  • Made SimplePolicyProcessor implement the ICanAddErrorFilter<SimplePolicyProcessor> interface.
  • Made SimplePolicy implement the ICanAddErrorFilter<SimplePolicy> interface.
  • Introduced the FallbackFuncsProvider.ToFallbackPolicy method.
  • Prevent NullReferenceException when a FallbackPolicyBase- derived class is initialized by FallbackFuncsProvider.
  • Introduced the BulkErrorProcessor.WithErrorContextProcessorOf<TErrorContext>(Func<Exception, ProcessingErrorInfo<TErrorContext>, CancellationToken, Task>) method.
  • Introduced the BulkErrorProcessor.WithErrorContextProcessorOf<TErrorContext>(Action<Exception, ProcessingErrorInfo<TErrorContext>, CancellationToken>) method.
  • Introduced the BulkErrorProcessor.WithErrorContextProcessorOf<TErrorContext>(Action<Exception, ProcessingErrorInfo<TErrorContext>>) extension method and its overloads.
  • Introduced the BulkErrorProcessor.WithErrorContextProcessorOf<TErrorContext>(Func<Exception, ProcessingErrorInfo<TErrorContext>, Task>) extension method and its overloads.
  • Introduced the BulkErrorProcessor.WithErrorContextProcessor<TErrorContext>(DefaultErrorProcessor<TErrorContext) method.
  • Introduced the GetAttemptCount() extensions method for ProcessingErrorInfo.
  • Introduced a DelayErrorProcessor constructor that accepts a RetryDelay parameter.
  • Add an internal extension method GetCancellationException() for AggregateException.
  • Refactor AddIncludedErrorFilterForAll<TException> extension methods for IEnumerable<IPolicyBase>.
  • Refactor AddExcludedErrorFilterForAll<TException> extension methods for IEnumerable<IPolicyBase>.
  • Handle null comparison safely in ErrorSetItem
  • Introduced the IBulkErrorProcessor.WithDelayBetweenRetries(TimeSpan) extension method.
  • Prevent NullReferenceException when ProcessingErrorContext parameter is null in BulkErrorProcessor.Process(Async) methods.
  • Refactor internal extension method ExceptionFilter.AddIncludedErrorSet.
  • Refactor internal extension method ExceptionFilter.AddExcludedErrorSet.
  • Refactor how the error context processor is added to the policy processor in the ErrorProcessorRegistration class.
  • Added internal IPolicyResultHandlerCollection interface.
  • Deprecate the BulkProcessStatus enum.

Docs changes

  • Edit 'RetryPolicy' README chapter.
  • Edit 'Key Concepts' README Chapter.
  • Add 'Tips and Tricks' README Chapter.

2.23.0

11 May 16:12

Choose a tag to compare

Improvements

  • Introduced the RetryPolicy.Handle<TErrorContext>(Action, TErrorContext, CancellationToken) method.
  • Introduced the RetryPolicy.Handle<TParam>(Action<TParam>, TParam, CancellationToken) method.
  • Introduced the RetryPolicy.Handle<TErrorContext, T>(Func<T>, TErrorContext, CancellationToken) method.
  • Introduced the RetryPolicy.Handle<TParam, T>(Func<TParam, T>, TParam, CancellationToken) method.
  • Introduced the RetryPolicy.HandleAsync<TErrorContext>(Func<CancellationToken, Task>, TErrorContext, ... ,CancellationToken) method overloads.
  • Introduced the RetryPolicy.HandleAsync<TParam>(Func<TParam, CancellationToken, Task>, TParam, ... ,CancellationToken) method overloads.
  • Introduced the RetryPolicy.HandleAsync<TErrorContext, T>(Func<CancellationToken, Task<T>>, TErrorContext, ...,CancellationToken) method overloads.
  • Introduced the RetryPolicy.HandleAsync<TParam, T>(Func<TParam, CancellationToken, Task<T>>, TParam, ... ,CancellationToken) method overloads.
  • Introduced the IRetryExecutionInfo interface, which is implemented by RetryProcessingErrorInfo and RetryProcessingErrorInfo<TParam>.
  • Introduced the GetRetryCount() extensions method for ProcessingErrorInfo.
  • Introduced the RetryPolicy.WithErrorContextProcessor<TErrorContext>(DefaultErrorProcessor<TErrorContext>) method.
  • Introduced the RetryPolicy.WithErrorContextProcessorOf<TErrorContext>(Action<Exception, ProcessingErrorInfo<TErrorContext>>) method and its overloads.
  • Introduced the RetryPolicy.WithErrorContextProcessorOf<TErrorContext>(Action<Exception, ProcessingErrorInfo<TErrorContext>, CancellationToken>) method.
  • Introduced the RetryPolicy.WithErrorContextProcessorOf<TErrorContext>(Func<Exception, ProcessingErrorInfo<TErrorContext>, Task>) and its overloads.
  • Introduced the RetryPolicy.WithErrorContextProcessorOf<TErrorContext>(Func<Exception, ProcessingErrorInfo<TErrorContext>, CancellationToken, Task>) method.
  • Added an optional bool excludeLastPolicy parameter (default: false) to the PolicyCollection.AddPolicyResultHandlerForAll(Func<PolicyResult, CancellationToken, Task>, ...) method.
  • Added an optional bool excludeLastPolicy parameter (default: false) to the PolicyCollection.AddPolicyResultHandlerForAll(Func<PolicyResult, Task>, CancellationType, ...) overloads.
  • Added an optional bool excludeLastPolicy parameter (default: false) to the PolicyCollection.AddPolicyResultHandlerForAll<T>(Func<PolicyResult<T>, Task>, CancellationType, ...) overloads.
  • Added an optional bool excludeLastPolicy parameter (default: false) to the PolicyCollection.AddPolicyResultHandlerForAll<T>(Action<PolicyResult<T>>, CancellationType, ...) overloads.
  • Added an optional bool excludeLastPolicy parameter (default: false) to the PolicyCollection.AddPolicyResultHandlerForAll<T>(Func<PolicyResult<T>, CancellationToken, Task>, ...) method.
  • Added an optional bool excludeLastPolicy parameter (default: false) to the PolicyCollection.AddPolicyResultHandlerForAll<T>(Action<PolicyResult<T>, CancellationToken>, ...) method.
  • Added an optional bool excludeLastPolicy parameter (default: false) to the PolicyCollection.AddPolicyResultHandlerForAll(Action<PolicyResult, CancellationToken>, ...) method.
  • Add an internal DelayErrorProcessor constructor overload that accepts an IDelayProvider.
  • Introduced the RetryDelay(Func<int, TimeSpan> delayValueProvider) constructor.
  • Introduced the RetryDelay(RetryDelayOptions) constructor.
  • Added the protected RetryDelay.DelayValueProvider property and deprecated the InnerDelay and InnerDelayValueProvider properties.
  • Added the ICanAddErrorFilter<T> interface and implemented it in RetryPolicy and DefaultRetryProcessor.
  • Introduced the IBulkErrorProcessor.WithDelayBetweenRetries(Func<int,Exception, TimeSpan>) extension method.
  • Introduced the TryCatchBuilder.AddCatchBlock(Func<IEmptyCatchBlockFilter, NonEmptyCatchBlockFilter>, IBulkErrorProcessor) method and deprecated the TryCatchBuilder.AddCatchBlock(Func<IEmptyCatchBlockFilter, NonEmptyCatchBlockFilter>, Action<IBulkErrorProcessor>) method.
  • Added the ExceptionFilter.AppendFilter(ExceptionFilter) method.
  • DRY refactoring to add a policy result handler to PolicyCollection.
  • Refactor Policy.HandlePolicyResult(Async) methods.

Docs changes

  • Update 'RetryPolicy' README Chapter.
  • Update NuGet package README.

Bumps and Dependency updates

  • Update System.Memory to version 4.0.5.0 in 'PoliNorError.Tests'.
  • Bump System.Runtime.CompilerServices.Unsafe and System.Threading.Tasks.Extensions in 'PoliNorError.Tests'.

2.22.0

26 Mar 15:29

Choose a tag to compare

Improvements

  • Introduced overloads of these methods, with and without the RetryDelay parameter:
    • DefaultRetryProcessor.RetryWithErrorContextAsync<TErrorContext>(Action, TErrorContext, ..., ..., CancellationToken)
    • DefaultRetryProcessor.Retry<TParam>(Action<TParam>, TParam, RetryCountInfo, RetryDelay, CancellationToken)
    • DefaultRetryProcessor.RetryInfiniteWithErrorContext<TErrorContext>(Action, TErrorContext, CancellationToken)
    • DefaultRetryProcessor.RetryInfinite<TParam>(Action<TParam>, TParam, ..., CancellationToken)
    • DefaultRetryProcessor.RetryWithErrorContextAsync<TErrorContext>(Func<CancellationToken, Task>, TErrorContext param, ..., ..., configureAwait, token)
    • DefaultRetryProcessor.RetryAsync<TParam>(Func<TParam, CancellationToken, Task>, TParam, ..., ..., bool, CancellationToken)
    • DefaultRetryProcessor.RetryInfiniteWithErrorContextAsync<TErrorContext>(Func<CancellationToken, Task>, TErrorContext, ..., bool, CancellationToken)
    • DefaultRetryProcessor.RetryInfiniteAsync<TParam>(Func<TParam, CancellationToken, Task>, TParam, bool, CancellationToken)
    • DefaultRetryProcessor.RetryWithErrorContext<TErrorContext, T>(Func<T> func, TErrorContext param, …, CancellationToken)
    • DefaultRetryProcessor.Retry<TParam, T>(Func<TParam, T>, TParam, ..., CancellationToken)
    • DefaultRetryProcessor.RetryInfiniteWithErrorContext<TErrorContext, T>(Func<T>, TErrorContext, CancellationToken)
    • DefaultRetryProcessor.RetryInfinite<TParam, T>(Func<TParam, T>, TParam, CancellationToken)
    • DefaultRetryProcessor.RetryWithErrorContextAsync<TErrorContext, T>(Func<CancellationToken, Task<T>>, TErrorContext, ..., bool, CancellationToken)
    • DefaultRetryProcessor.RetryAsync<TParam, T>(Func<TParam, CancellationToken, Task<T>, TParam, ..., bool, CancellationToken)
    • DefaultRetryProcessor.RetryInfiniteWithErrorContextAsync<TErrorContext, T>(Func<CancellationToken, Task<T>>, TErrorContext, ..., bool, CancellationToken)
    • DefaultRetryProcessor.RetryInfiniteAsync<TParam, T>(Func<TParam, CancellationToken, Task<T>>, TParam, ..., bool, CancellationToken)
  • Introduced the DefaultRetryProcessor.WithErrorContextProcessorOf<TErrorContext>(Action<Exception, ProcessingErrorInfo<TErrorContext>, CancellationToken>) method.
  • Introduced the DefaultRetryProcessor.WithErrorContextProcessor<TErrorContext>(DefaultErrorProcessor<TErrorContext>) method.
  • Introduced the DefaultRetryProcessor.WithErrorContextProcessorOf<TErrorContext>(Func<Exception, ProcessingErrorInfo<TErrorContext>, CancellationToken, Task>) method.
  • Introduced the DefaultRetryProcessor.WithErrorContextProcessorOf<TErrorContext>(Func<Exception, ProcessingErrorInfo<TErrorContext>, Task>) method overloads.
  • Refactor DelayIfNeed and DelayIfNeedAsync methods in DefaultRetryProcessor.
  • Introduced the TryCatchBuilder.AddCatchBlock(Func<IEmptyCatchBlockFilter, NonEmptyCatchBlockFilter>, Action<IBulkErrorProcessor) method.
  • Introduced the RetryProcessingErrorInfo<TParam> class along with related internal classes.
  • Applied DRY refactoring to DefaultRetryProcessor – added a lazily initialized private DelayProvider property.
  • Applied DRY refactoring to ExceptionFilter-dependent classes by adding the AddIncludedErrorFilter<TException> and AddExcludedErrorFilter<TException> methods.
  • Applied DRY refactoring to ExceptionFilter- dependent classes by adding the AddIncludedInnerErrorFilter<TException> and AddExcludedInnerErrorFilter<TException> methods.

Docs changes

  • Update the 'Key Concepts' chapter in the README.
  • Added a 'Key Concepts' section to the README.

Bumps and Dependency updates

  • Bump Castle.Core from 5.1.1 to 5.2.1.
  • Bump System.Runtime.CompilerServices.Unsafe and System.Threading.Tasks.Extensions.
  • Bump System.Buffers from 4.6.0 to 4.6.1 .

2.21.0

09 Feb 19:19

Choose a tag to compare

Improvements

  • Introduced the FallbackPolicyBase.Handle<TErrorContext>(Action, TErrorContext, CancellationToken) and FallbackPolicyBase.Handle<TParam>(Action<TParam>, TParam, CancellationToken) methods.
  • Introduced the FallbackPolicyBase.Handle<TParam, T>(Func<TParam, T>, TParam, CancellationToken) and FallbackPolicyBase.Handle<TErrorContext, T>(Func<T> func, TErrorContext param, CancellationToken) methods.
  • Introduced overloads for the FallbackPolicyBase.HandleAsync<TParam> and FallbackPolicyBase.HandleAsync<TErrorContext> methods.
  • Introduced overloads for the FallbackPolicyBase.HandleAsync<TParam, T> and FallbackPolicyBase.HandleAsync<TErrorContext, T> methods.
  • Introduced the WithErrorContextProcessor<TErrorContext> and WithErrorContextProcessorOf<TErrorContext> method overloads for FallbackPolicy, FallbackPolicyBase, FallbackPolicyWithAction, and FallbackPolicyWithAsyncFunc policies.
  • Introduced the DefaultFallbackProcessor.Fallback<TErrorContext>(Action, TErrorContext, Action<CancellationToken>, CancellationToken) method.
  • Introduced the DefaultFallbackProcessor.Fallback<TParam>(Action<TParam>, TParam, Action<CancellationToken>) method.
  • Introduced the DefaultFallbackProcessor.Fallback<TErrorContext, T>(Func<T>, TErrorContext, Func<CancellationToken, T>) method.
  • Introduced the DefaultFallbackProcessor.Fallback<TParam, T>(Func<TParam, T>, TParam, Func<CancellationToken, T>, CancellationToken) method.
  • Introduced the DefaultFallbackProcessor.FallbackAsync<TErrorContext>(Func<CancellationToken, Task>, TErrorContext, Func<CancellationToken, Task>, bool, CancellationToken) method.
  • Introduced the DefaultFallbackProcessor.FallbackAsync<TParam>(Func<TParam, CancellationToken, Task>, TParam, Func<CancellationToken, Task>, bool, CancellationToken) method.
  • Introduced the DefaultFallbackProcessor.FallbackAsync<TErrorContext, T>(Func<CancellationToken, Task<T>>, TErrorContext, Func<CancellationToken, Task<T>>, bool, CancellationToken) method.
  • Introduced the DefaultFallbackProcessor.FallbackAsync<TParam, T>(Func<TParam, CancellationToken, Task<T>>, TParam, Func<CancellationToken, Task<T>>, bool, CancellationToken) method.
  • Introduced the WithErrorContextProcessor<TErrorContext>(DefaultErrorProcessor<TErrorContext>) method in DefaultFallbackProcessor.
  • Introduced the DefaultFallbackProcessor.WithErrorContextProcessorOf<TErrorContext> method overloads.

Small changes

  • DefaultRetryProcessor refactoring - make the field representing the retry policy rule static and simplify RetryErrorContext creation.
  • Apply the 'check reference equality instead' Rider rule to type comparisons in the DefaultRetryProcessor.RetryInternal<T> method.

Docs changes

  • Update NuGet README.
  • Updated 'Usage' in README for 2.20.0 changes.
  • Update 'TryCatch' README Chapter.
  • Update the Error processors chapter in the README.
  • Add diagrams to README.

Bumps and Dependency updates

  • Bump the nunit group with 7 updates.

2.20.0

25 Dec 14:45

Choose a tag to compare

Improvements

  • Introduce the DefaultErrorProcessor<TParam> , ProcessingErrorContext<TParam> and ProcessingErrorInfo<TParam> classes.
  • Introduce the SimplePolicy.Handle<TErrorContext>(Action, TErrorContext, CancellationToken) method.
  • Introduce the SimplePolicy.Handle<TParam>(Action<TParam>, TParam, CancellationToken) method.
  • Introduce the Handle<TParam, T>(Func<TParam, T>, TParam, CancellationToken) and Handle<TErrorContext, T>(Func<T> func, TErrorContext param, CancellationToken) methods of SimplePolicy.
  • Introduce overloads for the SimplePolicy.HandleAsync<TParam> and SimplePolicy.HandleAsync<TErrorContext> methods.
  • Introduce overloads for the SimplePolicy.HandleAsync<TParam, T> and SimplePolicy.HandleAsync<TErrorContext, T> methods.
  • Introduce the SimplePolicy.WithErrorContextProcessor<TErrorContext> and SimplePolicy.WithErrorContextProcessorOf<TErrorContext> method overloads.
  • Introduce the SimplePolicyProcessor.Execute<TParam>(Action) method.
  • Introduce the SimplePolicyProcessor.Execute<TParam>(Action<TParam>, TParam, token) method.
  • Introduce the SimplePolicyProcessor.Execute<TErrorContext, T>(Func<T>, TErrorContext, CancellationToken) method.
  • Introduce the SimplePolicyProcessor.Execute<TParam, T>(Func<TParam, T>, TParam, CancellationToken) method.
  • Introduce the SimplePolicyProcessor.ExecuteAsync<TErrorContext>(Func<CancellationToken, Task>, TErrorContext, bool, CancellationToken) method.
  • Introduce the SimplePolicyProcessor.ExecuteAsync<TParam>(Func<TParam, CancellationToken, Task>, TParam, bool, CancellationToken) method.
  • Introduce the SimplePolicyProcessor.ExecuteAsync<TErrorContext, T>(Func<CancellationToken, Task<T>>, TErrorContext, bool, CancellationToken) method.
  • Introduce the SimplePolicyProcessor.ExecuteAsync<TParam, T>(Func<TParam, CancellationToken, Task<T>>, TParam, bool, CancellationToken) method.
  • Introduce the SimplePolicyProcessor.WithErrorContextProcessor<TErrorContext> and SimplePolicyProcessor.WithErrorContextProcessorOf<TErrorContext> method overloads.
  • Introduce the Func<CancellationToken, Task<T>>.InvokeWithTryCatchAsync extension method.
  • Introduce InvokeWithTryCatchAsync extension methods overloads for the Func<CancellationToken, Task<T>>, Func<CancellationToken, Task> delegates.
  • Introduce the Func<CancellationToken, Task>.InvokeWithTryCatchAsync extension method.
  • Introduce the Func<T>.InvokeWithTryCatch extension method.
  • Introduce the Action.InvokeWithTryCatch extension method.
  • Introduce TryCatchBuilder.AddCatchBlock method overloads with NonEmptyCatchBlockFilter, IBulkErrorProcessor parameters.
  • Introduce the TryCatchBuilder.AddCatchBlock method overload with the NonEmptyCatchBlockFilter parameter.
  • Introduce the TryCatchBuilder.AddCatchBlock method overload with the IBulkErrorProcessor parameter.
  • Introduce TryCatchBuilder.CreateFrom method overload with NonEmptyCatchBlockFilter, IBulkErrorProcessor parameters.
  • Introduce the TryCatchBuilder.CreateFrom method overload with the NonEmptyCatchBlockFilter parameter.
  • Introduce the TryCatchBuilder.CreateFrom method overload with the IBulkErrorProcessor parameter.
  • Introduce shorthand TryCatchBuilder.CreateAndBuild method without parameters.
  • Introduce shorthand TryCatchBuilder.CreateAndBuild method with the IBulkErrorProcessor parameter
  • Introduce shorthand TryCatchBuilder.CreateAndBuild method with the Func<Exception, Task> parameter.
  • Introduce shorthand TryCatchBuilder.CreateAndBuild method with the Action<Exception> parameter.

Small changes

  • Deprecate the BulkErrorProcessor(PolicyAlias) constructor.
  • Made PolicyProcessor constructors that use the PolicyAlias parameter and the _isPolicyAliasSet field obsolete.
  • Call the ConfigureAwait method in the ErrorProcessorBase.ProcessAsync method with the configAwait parameter passed.
  • Add the internal class EmptyErrorContext<TParam>.
  • Add the Policy.HasPolicyWrapperFactory internal property.
  • Add the Rider-related .gitignore.

Docs changes

  • Edit 'Policy wrap' README Chapter.
  • Update 'RetryPolicy' README Chapter and example in README for NuGet package.

Bumps and Dependency updates

  • Bump the nunit group with 7 updates.
  • Remove old references to NUnit-related nuget packages in the PoliNorError.Tests project file.

2.19.15

17 Nov 15:54

Choose a tag to compare

Improvements

  • Introduce RetryPolicy.WithWait(DelayErrorProcessor) method.
  • DefaultRetryProcessor refactoring - add field representing retry policy rule.
  • Add the RetryContext.IsZeroRetry property and use it to set the PolicyResult.NoError property to true.
  • Slightly improved performance for the RetryPolicy custom error saver by passing the ErrorContext<RetryContext> instead of int tryCount arg in the DefaultRetryProcessor.SaveError(Async) methods.
  • Deprecate ProcessingErrorContext.CurrentRetryCount property.
  • Introduce the Policy.WrapPolicyCollection extension method.
  • Argument exception guard clause for the PolicyCollection.WrapUp method with the ThrowOnWrappedCollectionFailed.None value for the throwOnWrappedCollectionFailed parameter.
  • Argument exception guard clause for the Policy.WrapPolicyCollection method with the ThrowOnWrappedCollectionFailed.None value for the throwOnWrappedCollectionFailed parameter.
  • Made the Policy class constructor protected (previously private protected).
  • Introduce PolicyResultHandlerFailedException.Result property.
  • Introduce PolicyResultHandlerFailedException<T> exception.

Small changes

  • Made the cancellationToken parameter optional in PolicyDelegate(<T>).HandleAsync methods.
  • Directly return Task instead of await when converting async uncancelable generic fallback delegate to cancelable with CancellationType.Precancelable argument.
  • New tests for the PolicyCollection.WrapUp method with the ThrowOnWrappedCollectionFailed.CollectionError parameter.
  • New tests for a wrapped SimplePolicy that wraps another policy.
  • Move the tests for the RetryDelay classes to a separate folder.

Docs changes

  • Add doc comments to the public members of the PolicyBuilding class.
  • Put the nuget README in the file.
  • Update 'RetryPolicy' README Chapter.
  • Correct retry terminology in README.
  • Correct 'Error processors' README Chapters.

Bumps and Dependency updates

  • Bump NSubstitute from 5.1.0 to 5.3.0.
  • Bump System.Numerics.Vectors from 4.5.0 to 4.6.0.
  • Bump System.Buffers from 4.5.1 to 4.6.0.
  • Bump System.Runtime.CompilerServices.Unsafe from 6.0.0 to 6.1.0.

2.19.11

16 Oct 10:35

Choose a tag to compare

Improvements

  • Introduce SlopeFactor for LinearRetryDelay.
  • Slightly improved performance for RetryPolicy by removing the overhead of using the int tryCount argument in the DefaultRetryProcessor.DelayIfNeedAsync(Async) methods.
  • Introduce PolicyCollection.WithRetry, PolicyCollection.WithInfiniteRetry methods with RetryDelay parameter.
  • Introduce PolicyDelegateCollection.WithRetry, PolicyDelegateCollection.WithInfiniteRetry methods with RetryDelay parameter.
  • Introduce PolicyDelegateCollection<T>.WithRetry, PolicyDelegateCollection<T>.WithInfiniteRetry methods with RetryDelay parameter.
  • Introduce RetryPolicy.SetPolicyResultFailedIf method overloads with Action<PolicyResult<T>> handler parameter for RetryPolicy, SimplePolicy and Fallback policies.

Small changes

  • Move null guards before getting a fallback delegate in FallbackPolicyBase.
  • Remove deprecated suppression for PolicyResultHandlingException.

Docs changes

  • Add doc comments to the public members of the PolicyDelegate and PolicyDelegate<T> classes.
  • Add doc comments to the public members of the PolicyDelegateResult and PolicyDelegateResult<T> classes.
  • Add doc comments to the public members of the PolicyResult and PolicyResult<T> classes, and to the PolicyResultFailedReason enum.
  • Update 'Calling Func and Action delegates in a resilient manner' README Chapter.
  • Update 'RetryPolicy' README Chapter.

2.19.8

22 Sep 13:42

Choose a tag to compare

Improvements

  • Introduce Policy error filtering extension methods in the PoliNorError.Extensions.PolicyErrorFiltering namespace.
  • Fix issue #126 by using the IDelayProvider.BackoffBackoffSafely(Async) extension methods.
  • Introduce Action.InvokeWithRetryDelay extension methods.
  • Introduce Action.InvokeWithRetryDelayInfinite  extension methods.
  • Introduce Func<CancellationToken, Task>.InvokeWithRetryDelayAsync extension methods.
  • Introduce Func<CancellationToken, Task>.InvokeWithRetryDelayInfiniteAsync extension methods.
  • Introduce Func<T>.InvokeWithRetryDelay extension methods.
  • Introduce Func<T>.InvokeWithRetryDelayInfinite extension methods.
  • Introduce Func<CancellationToken, Task<T>>.InvokeWithRetryDelayAsync extension methods.
  • Introduce Func<CancellationToken, Task<T>>.InvokeWithRetryDelayInfiniteAsync extension methods.

Small changes

  • Add early return in RetryProcessor.Retry(Async)(<T>) methods if token is already canceled.
  • DRY Refactoring of the use of RetryDelay in DefaultRetryProcessor methods.
  • Refactor catch block exception handling in DefaultRetryProcessor.Retry(Async)<T> methods.
  • Add 'Try', 'Catch' tags to nuget package.

Docs changes

  • Update 'RetryPolicy' README Chapter.
  • Add doc comments to CatchBlockExceptionSource.
  • Bump NUnit from 4.1.0 to 4.2.1.
  • Bump NUnit from 4.2.1 to 4.2.2.