title: Polly - Please use asynchronous-defined policies when calling asynchronous ExecuteAsync (and similar) methods
body: <p>I am getting the above exception when executing a wrapped policy including: retry, circuit breaker and bulk head.</p>
  
  <p>I have the following policies:</p>
  
  <pre><code>var sharedBulkhead = Policy.BulkheadAsync(
              maxParallelization: maxParallelizations, 
              maxQueuingActions: maxQueuingActions,
              onBulkheadRejectedAsync: (context) =&gt;
              {
                  Log.Info($"Bulk head rejected =&gt; Policy Wrap: {context.PolicyWrapKey}, Policy: {context.PolicyKey}, Endpoint: {context.OperationKey}");
                  return TaskHelper.EmptyTask;
              }
          );
  
  var retryPolicy = Policy.Handle&lt;Exception&gt;(e =&gt; (e is HttpRequestException)).WaitAndRetryAsync(
              retryCount: maxRetryCount,
              sleepDurationProvider: attempt =&gt; TimeSpan.FromSeconds(Math.Pow(2, attempt)),
              onRetryAsync: (exception, calculatedWaitDuration, retryCount, context) =&gt;
              {
                  Log.Error($"Retry =&gt; Count: {retryCount}, Wait duration: {calculatedWaitDuration}, Policy Wrap: {context.PolicyWrapKey}, Policy: {context.PolicyKey}, Endpoint: {context.OperationKey}, Exception: {exception}.");
                  return TaskHelper.EmptyTask;
              });
  
              var circuitBreaker = Policy.Handle&lt;Exception&gt;(e =&gt; (e is HttpRequestException)).CircuitBreakerAsync(
              exceptionsAllowedBeforeBreaking: maxExceptionsBeforeBreaking, 
              durationOfBreak: TimeSpan.FromSeconds(circuitBreakDurationSeconds), 
              onBreak: (exception, timespan, context) =&gt;
              {
                  Log.Error($"Circuit broken =&gt; Policy Wrap: {context.PolicyWrapKey}, Policy: {context.PolicyKey}, Endpoint: {context.OperationKey}, Exception: {exception}");
              },
              onReset: (context) =&gt;
              {
                  Log.Info($"Circuit reset =&gt; Policy Wrap: {context.PolicyWrapKey}, Policy: {context.PolicyKey}, Endpoint: {context.OperationKey}");
              }
          );
  
  var fallbackForCircuitBreaker = Policy&lt;bool&gt;
           .Handle&lt;BrokenCircuitException&gt;()
           .FallbackAsync(
               fallbackValue: false,
               onFallbackAsync: (b, context) =&gt;
               {
                   Log.Error($"Operation attempted on broken circuit =&gt; Policy Wrap: {context.PolicyWrapKey}, Policy: {context.PolicyKey}, Endpoint: {context.OperationKey}");
                   return TaskHelper.EmptyTask;
               }
           );
  
  var fallbackForAnyException = Policy&lt;bool&gt;
              .Handle&lt;Exception&gt;()
              .FallbackAsync(
                  fallbackAction: (ct, context) =&gt; { return Task.FromResult(false); },
                  onFallbackAsync: (e, context) =&gt;
                  {
                      Log.Error($"An unexpected error occured =&gt; Policy Wrap: {context.PolicyWrapKey}, Policy: {context.PolicyKey}, Endpoint: {context.OperationKey}");
                      return TaskHelper.EmptyTask;
                  }
              );
  
  
  var resilienceStrategy = Policy.WrapAsync(retryPolicy, circuitBreaker, sharedBulkhead);
          var policyWrap = fallbackForAnyException.WrapAsync(fallbackForCircuitBreaker.Wrap(resilienceStrategy));
  </code></pre>
  
  <p>I execute the policy like so:</p>
  
  <pre><code>Task.Run(() =&gt;
          {
              foreach (var changeMessage in changeMessages)
              {
                  policyWrap.ExecuteAsync((context) =&gt; CallApi(changeMessage), new Context(endPoint));
              }
          });
  </code></pre>
  
  <p>This is producing the said exception: "Please use asynchronous-defined policies when calling asynchronous ExecuteAsync (and similar) methods." inside the <code>fallbackForAnyException</code>. What am I doing wrong?</p>