From 919e37101a43fa0532c74cb0587ee2742bd3a9cf Mon Sep 17 00:00:00 2001 From: reisenberger Date: Wed, 31 Jan 2018 19:32:07 +0000 Subject: [PATCH] Make DebuggerStepThrough attributes consistent ... and add missing intellisense --- src/Polly.Shared/Caching/CachePolicy.cs | 2 ++ src/Polly.Shared/Caching/CachePolicyAsync.cs | 2 ++ src/Polly.Shared/Fallback/FallbackPolicy.cs | 2 ++ src/Polly.Shared/Policy.cs | 2 +- src/Polly.Shared/Wrap/PolicyWrap.cs | 2 ++ src/Polly.Shared/Wrap/PolicyWrapAsync.cs | 2 ++ 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Polly.Shared/Caching/CachePolicy.cs b/src/Polly.Shared/Caching/CachePolicy.cs index ec66958be06..53732c6ccfc 100644 --- a/src/Polly.Shared/Caching/CachePolicy.cs +++ b/src/Polly.Shared/Caching/CachePolicy.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using System.Threading; using Polly.Utilities; @@ -51,6 +52,7 @@ internal CachePolicy( /// Execution context that is passed to the exception policy; defines the cache key to use in cache lookup. /// The cancellation token. /// The value returned by the action, or the cache. + [DebuggerStepThrough] public override TResult ExecuteInternal(Func action, Context context, CancellationToken cancellationToken) { return CacheEngine.Implementation( diff --git a/src/Polly.Shared/Caching/CachePolicyAsync.cs b/src/Polly.Shared/Caching/CachePolicyAsync.cs index 564bc022ccb..84f7e23728a 100644 --- a/src/Polly.Shared/Caching/CachePolicyAsync.cs +++ b/src/Polly.Shared/Caching/CachePolicyAsync.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -43,6 +44,7 @@ internal CachePolicy( /// The cancellation token. /// Whether to continue on a captured synchronization context. /// The value returned by the action, or the cache. + [DebuggerStepThrough] public override Task ExecuteAsyncInternal(Func> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext) { return CacheEngine.ImplementationAsync( diff --git a/src/Polly.Shared/Fallback/FallbackPolicy.cs b/src/Polly.Shared/Fallback/FallbackPolicy.cs index 0d9c1906325..1e53f057791 100644 --- a/src/Polly.Shared/Fallback/FallbackPolicy.cs +++ b/src/Polly.Shared/Fallback/FallbackPolicy.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Threading; namespace Polly.Fallback @@ -22,6 +23,7 @@ internal FallbackPolicy(Action, Context, Canc /// Execution context that is passed to the exception policy; defines the cache key to use in cache lookup. /// The cancellation token. /// The value returned by the action, or the cache. + [DebuggerStepThrough] public override TResult ExecuteInternal(Func action, Context context, CancellationToken cancellationToken) { throw new InvalidOperationException($"You have executed the generic .Execute<{nameof(TResult)}> method on a non-generic {nameof(FallbackPolicy)}. A non-generic {nameof(FallbackPolicy)} only defines a fallback action which returns void; it can never return a substitute {nameof(TResult)} value. To use {nameof(FallbackPolicy)} to provide fallback {nameof(TResult)} values you must define a generic fallback policy {nameof(FallbackPolicy)}<{nameof(TResult)}>. For example, define the policy as Policy<{nameof(TResult)}>.Handle.Fallback<{nameof(TResult)}>(/* some {nameof(TResult)} value or Func<..., {nameof(TResult)}> */);"); diff --git a/src/Polly.Shared/Policy.cs b/src/Polly.Shared/Policy.cs index fe4a84b20c9..2fe693f1f1f 100644 --- a/src/Polly.Shared/Policy.cs +++ b/src/Polly.Shared/Policy.cs @@ -86,7 +86,7 @@ public void Execute(Action action, Context context) } /// - /// + /// Executes the specified action within the policy /// /// /// diff --git a/src/Polly.Shared/Wrap/PolicyWrap.cs b/src/Polly.Shared/Wrap/PolicyWrap.cs index 4e8b113369b..495cb8bf9c7 100644 --- a/src/Polly.Shared/Wrap/PolicyWrap.cs +++ b/src/Polly.Shared/Wrap/PolicyWrap.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Threading; using Polly.Utilities; @@ -37,6 +38,7 @@ internal PolicyWrap(Action, Context, Cancella /// Execution context that is passed to the exception policy; defines the cache key to use in cache lookup. /// The cancellation token. /// The value returned by the action, or the cache. + [DebuggerStepThrough] public override TResult ExecuteInternal(Func action, Context context, CancellationToken cancellationToken) { return PolicyWrapEngine.Implementation( diff --git a/src/Polly.Shared/Wrap/PolicyWrapAsync.cs b/src/Polly.Shared/Wrap/PolicyWrapAsync.cs index 3253d8678af..ce831f91037 100644 --- a/src/Polly.Shared/Wrap/PolicyWrapAsync.cs +++ b/src/Polly.Shared/Wrap/PolicyWrapAsync.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; using Polly.Utilities; @@ -23,6 +24,7 @@ internal PolicyWrap(Func, Context, Cancel /// The cancellation token. /// Whether to continue on a captured synchronization context. /// The value returned by the action, or the cache. + [DebuggerStepThrough] public override Task ExecuteAsyncInternal(Func> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext) { return PolicyWrapEngine.ImplementationAsync(