From 0d249c45978afa29f56bfeafa1c8ae60e5484283 Mon Sep 17 00:00:00 2001 From: martincostello Date: Wed, 14 Aug 2024 11:05:24 +0100 Subject: [PATCH] Suppress S3236 Suppress S3236 warnings. --- src/Polly.Core/ResilienceContext.cs | 2 ++ src/Polly.Core/Retry/RetryHelper.cs | 2 ++ src/Polly.Core/Retry/RetryResilienceStrategy.cs | 2 ++ src/Polly.Core/Utils/TaskHelper.cs | 1 + 4 files changed, 7 insertions(+) diff --git a/src/Polly.Core/ResilienceContext.cs b/src/Polly.Core/ResilienceContext.cs index d77d1d2a1cc..d20d3b03866 100644 --- a/src/Polly.Core/ResilienceContext.cs +++ b/src/Polly.Core/ResilienceContext.cs @@ -74,9 +74,11 @@ internal void InitializeFrom(ResilienceContext context, CancellationToken cancel Properties.AddOrReplaceProperties(context.Properties); } +#pragma warning disable S3236 // Remove this argument from the method call; it hides the caller information. [ExcludeFromCodeCoverage] [Conditional("DEBUG")] internal void AssertInitialized() => Debug.Assert(IsInitialized, "The resilience context is not initialized."); +#pragma warning restore S3236 // Remove this argument from the method call; it hides the caller information. internal ResilienceContext Initialize(bool isSynchronous) { diff --git a/src/Polly.Core/Retry/RetryHelper.cs b/src/Polly.Core/Retry/RetryHelper.cs index 1acbbf8f6cc..9736a83375c 100644 --- a/src/Polly.Core/Retry/RetryHelper.cs +++ b/src/Polly.Core/Retry/RetryHelper.cs @@ -124,7 +124,9 @@ private static TimeSpan DecorrelatedJitterBackoffV2(int attempt, TimeSpan baseDe long ticks = (long)Math.Min(formulaIntrinsicValue * RpScalingFactor * targetTicksFirstDelay, MaxTimeSpanTicks); +#pragma warning disable S3236 // Remove this argument from the method call; it hides the caller information. Debug.Assert(ticks >= 0, "ticks cannot be negative"); +#pragma warning restore S3236 // Remove this argument from the method call; it hides the caller information. return TimeSpan.FromTicks(ticks); } diff --git a/src/Polly.Core/Retry/RetryResilienceStrategy.cs b/src/Polly.Core/Retry/RetryResilienceStrategy.cs index 484b78d48cf..823c1502c31 100644 --- a/src/Polly.Core/Retry/RetryResilienceStrategy.cs +++ b/src/Polly.Core/Retry/RetryResilienceStrategy.cs @@ -75,7 +75,9 @@ protected internal override async ValueTask> ExecuteCore(Func } } +#pragma warning disable S3236 // Remove this argument from the method call; it hides the caller information. Debug.Assert(delay >= TimeSpan.Zero, "The delay cannot be negative."); +#pragma warning restore S3236 // Remove this argument from the method call; it hides the caller information. var onRetryArgs = new OnRetryArguments(context, outcome, attempt, delay, executionTime); _telemetry.Report, T>(new(ResilienceEventSeverity.Warning, RetryConstants.OnRetryEvent), onRetryArgs); diff --git a/src/Polly.Core/Utils/TaskHelper.cs b/src/Polly.Core/Utils/TaskHelper.cs index cd998dea2b7..d874af21aba 100644 --- a/src/Polly.Core/Utils/TaskHelper.cs +++ b/src/Polly.Core/Utils/TaskHelper.cs @@ -1,5 +1,6 @@ namespace Polly.Utils; +#pragma warning disable S3236 // Remove this argument from the method call; it hides the caller information. #pragma warning disable S5034 // "ValueTask" should be consumed correctly internal static class TaskHelper