<PackageReference Include="Polly" Version="1.1.0" />

RetryPolicyState

using System; namespace Polly.Retry { internal class RetryPolicyState : IRetryPolicyState { private readonly Action<Exception, Context> _onRetry; private readonly Context _context; public RetryPolicyState(Action<Exception, Context> onRetry, Context context) { _onRetry = onRetry; _context = context; } public RetryPolicyState(Action<Exception> onRetry) { Action<Exception, Context> onRetry2 = delegate(Exception exception, Context context) { onRetry(exception); }; this..ctor(onRetry2, null); } public bool CanRetry(Exception ex) { _onRetry(ex, _context); return true; } } }