diff --git a/src/Polly/Polly.csproj b/src/Polly/Polly.csproj index b7353686b1c..651825f1047 100644 --- a/src/Polly/Polly.csproj +++ b/src/Polly/Polly.csproj @@ -7,7 +7,7 @@ Library 70 true - $(NoWarn);S3872;SA1414;S3215 + $(NoWarn);SA1414;S3215 $(NoWarn);IDE1006;CA1062;CA1068;S4039;CA1063;CA1031;CA1051 $(NoWarn);CA2211;S2223;CA1032;CA1815;CA1816;S4457;CA1033 $(NoWarn);CA1010;CA1064;SA1118 diff --git a/src/Polly/Timeout/TimeoutSyntax.cs b/src/Polly/Timeout/TimeoutSyntax.cs index 11e93aef83a..5c9574eae07 100644 --- a/src/Polly/Timeout/TimeoutSyntax.cs +++ b/src/Polly/Timeout/TimeoutSyntax.cs @@ -103,6 +103,7 @@ public static TimeoutPolicy Timeout(int seconds, TimeoutStrategy timeoutStrategy return Timeout(_ => TimeSpan.FromSeconds(seconds), timeoutStrategy, onTimeout); } +#pragma warning disable S3872 /// /// Builds a that will wait for a delegate to complete for a specified period of time. A will be thrown if the delegate does not complete within the configured timeout. /// @@ -110,6 +111,7 @@ public static TimeoutPolicy Timeout(int seconds, TimeoutStrategy timeoutStrategy /// The policy instance. /// timeout;Value must be a positive TimeSpan (or Timeout.InfiniteTimeSpan to indicate no timeout). public static TimeoutPolicy Timeout(TimeSpan timeout) +#pragma warning restore S3872 { TimeoutValidator.ValidateTimeSpanTimeout(timeout); Action doNothing = (_, _, _, _) => { }; @@ -117,6 +119,7 @@ public static TimeoutPolicy Timeout(TimeSpan timeout) return Timeout(_ => timeout, TimeoutStrategy.Optimistic, doNothing); } +#pragma warning disable S3872 /// /// Builds a that will wait for a delegate to complete for a specified period of time. A will be thrown if the delegate does not complete within the configured timeout. /// @@ -125,6 +128,7 @@ public static TimeoutPolicy Timeout(TimeSpan timeout) /// The policy instance. /// timeout;Value must be a positive TimeSpan (or Timeout.InfiniteTimeSpan to indicate no timeout). public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutStrategy timeoutStrategy) +#pragma warning restore S3872 { TimeoutValidator.ValidateTimeSpanTimeout(timeout); Action doNothing = (_, _, _, _) => { }; @@ -132,6 +136,7 @@ public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutStrategy timeoutStr return Timeout(_ => timeout, timeoutStrategy, doNothing); } +#pragma warning disable S3872 /// /// Builds a that will wait for a delegate to complete for a specified period of time. A will be thrown if the delegate does not complete within the configured timeout. /// @@ -142,12 +147,14 @@ public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutStrategy timeoutStr /// timeout;Value must be a positive TimeSpan (or Timeout.InfiniteTimeSpan to indicate no timeout). /// Thrown when is . public static TimeoutPolicy Timeout(TimeSpan timeout, Action onTimeout) +#pragma warning restore S3872 { TimeoutValidator.ValidateTimeSpanTimeout(timeout); return Timeout(_ => timeout, TimeoutStrategy.Optimistic, onTimeout); } +#pragma warning disable S3872 /// /// Builds a that will wait for a delegate to complete for a specified period of time. A will be thrown if the delegate does not complete within the configured timeout. /// @@ -158,12 +165,14 @@ public static TimeoutPolicy Timeout(TimeSpan timeout, Actiontimeout;Value must be greater than zero. /// Thrown when is . public static TimeoutPolicy Timeout(TimeSpan timeout, Action onTimeout) +#pragma warning restore S3872 { TimeoutValidator.ValidateTimeSpanTimeout(timeout); return Timeout(_ => timeout, TimeoutStrategy.Optimistic, onTimeout); } +#pragma warning disable S3872 /// /// Builds a that will wait for a delegate to complete for a specified period of time. A will be thrown if the delegate does not complete within the configured timeout. /// @@ -175,12 +184,14 @@ public static TimeoutPolicy Timeout(TimeSpan timeout, Actiontimeout;Value must be a positive TimeSpan (or Timeout.InfiniteTimeSpan to indicate no timeout). /// Thrown when is . public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutStrategy timeoutStrategy, Action onTimeout) +#pragma warning restore S3872 { TimeoutValidator.ValidateTimeSpanTimeout(timeout); return Timeout(_ => timeout, timeoutStrategy, onTimeout); } +#pragma warning disable S3872 /// /// Builds a that will wait for a delegate to complete for a specified period of time. A will be thrown if the delegate does not complete within the configured timeout. /// @@ -192,6 +203,7 @@ public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutStrategy timeoutStr /// timeout;Value must be greater than zero. /// Thrown when is . public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutStrategy timeoutStrategy, Action onTimeout) +#pragma warning restore S3872 { TimeoutValidator.ValidateTimeSpanTimeout(timeout); diff --git a/src/Polly/Timeout/TimeoutTResultSyntax.cs b/src/Polly/Timeout/TimeoutTResultSyntax.cs index 4bac3b4d8b6..0bb9490ae09 100644 --- a/src/Polly/Timeout/TimeoutTResultSyntax.cs +++ b/src/Polly/Timeout/TimeoutTResultSyntax.cs @@ -108,6 +108,7 @@ public static TimeoutPolicy Timeout(int seconds, TimeoutStrate return Timeout(_ => TimeSpan.FromSeconds(seconds), timeoutStrategy, onTimeout); } +#pragma warning disable S3872 /// /// Builds a that will wait for a delegate to complete for a specified period of time. A will be thrown if the delegate does not complete within the configured timeout. /// @@ -116,6 +117,7 @@ public static TimeoutPolicy Timeout(int seconds, TimeoutStrate /// The policy instance. /// timeout;Value must be a positive TimeSpan (or Timeout.InfiniteTimeSpan to indicate no timeout). public static TimeoutPolicy Timeout(TimeSpan timeout) +#pragma warning restore S3872 { TimeoutValidator.ValidateTimeSpanTimeout(timeout); Action doNothing = (_, _, _, _) => { }; @@ -123,6 +125,7 @@ public static TimeoutPolicy Timeout(TimeSpan timeout) return Timeout(_ => timeout, TimeoutStrategy.Optimistic, doNothing); } +#pragma warning disable S3872 /// /// Builds a that will wait for a delegate to complete for a specified period of time. A will be thrown if the delegate does not complete within the configured timeout. /// @@ -132,6 +135,7 @@ public static TimeoutPolicy Timeout(TimeSpan timeout) /// The policy instance. /// timeout;Value must be a positive TimeSpan (or Timeout.InfiniteTimeSpan to indicate no timeout). public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutStrategy timeoutStrategy) +#pragma warning restore S3872 { TimeoutValidator.ValidateTimeSpanTimeout(timeout); Action doNothing = (_, _, _, _) => { }; @@ -139,6 +143,7 @@ public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutS return Timeout(_ => timeout, timeoutStrategy, doNothing); } +#pragma warning disable S3872 /// /// Builds a that will wait for a delegate to complete for a specified period of time. A will be thrown if the delegate does not complete within the configured timeout. /// @@ -150,11 +155,13 @@ public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutS /// timeout;Value must be a positive TimeSpan (or Timeout.InfiniteTimeSpan to indicate no timeout). /// Thrown when is . public static TimeoutPolicy Timeout(TimeSpan timeout, Action onTimeout) +#pragma warning restore S3872 { TimeoutValidator.ValidateTimeSpanTimeout(timeout); return Timeout(_ => timeout, TimeoutStrategy.Optimistic, onTimeout); } +#pragma warning disable S3872 /// /// Builds a that will wait for a delegate to complete for a specified period of time. A will be thrown if the delegate does not complete within the configured timeout. /// @@ -166,11 +173,13 @@ public static TimeoutPolicy Timeout(TimeSpan timeout, Actiontimeout;Value must be greater than zero. /// Thrown when is . public static TimeoutPolicy Timeout(TimeSpan timeout, Action onTimeout) +#pragma warning restore S3872 { TimeoutValidator.ValidateTimeSpanTimeout(timeout); return Timeout(_ => timeout, TimeoutStrategy.Optimistic, onTimeout); } +#pragma warning disable S3872 /// /// Builds a that will wait for a delegate to complete for a specified period of time. A will be thrown if the delegate does not complete within the configured timeout. /// @@ -183,11 +192,13 @@ public static TimeoutPolicy Timeout(TimeSpan timeout, Actiontimeout;Value must be a positive TimeSpan (or Timeout.InfiniteTimeSpan to indicate no timeout). /// Thrown when is . public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutStrategy timeoutStrategy, Action onTimeout) +#pragma warning restore S3872 { TimeoutValidator.ValidateTimeSpanTimeout(timeout); return Timeout(_ => timeout, timeoutStrategy, onTimeout); } +#pragma warning disable S3872 /// /// Builds a that will wait for a delegate to complete for a specified period of time. A will be thrown if the delegate does not complete within the configured timeout. /// @@ -200,6 +211,7 @@ public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutS /// timeout;Value must be greater than zero. /// Thrown when is . public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutStrategy timeoutStrategy, Action onTimeout) +#pragma warning restore S3872 { TimeoutValidator.ValidateTimeSpanTimeout(timeout); return Timeout(_ => timeout, timeoutStrategy, onTimeout);