diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 7dff83718b0..1679d2a1285 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -14,7 +14,7 @@ - + diff --git a/src/Polly.Core.Tests/Hedging/Controller/HedgingExecutionContextTests.cs b/src/Polly.Core.Tests/Hedging/Controller/HedgingExecutionContextTests.cs index 38162137d19..4f8e97d87b4 100644 --- a/src/Polly.Core.Tests/Hedging/Controller/HedgingExecutionContextTests.cs +++ b/src/Polly.Core.Tests/Hedging/Controller/HedgingExecutionContextTests.cs @@ -132,8 +132,8 @@ public async Task TryWaitForCompletedExecutionAsync_ConcurrentExecution_Ok() _timeProvider.Advance(TimeSpan.FromDays(1)); await context.TryWaitForCompletedExecutionAsync(TimeSpan.Zero); - await context.Tasks.First().ExecutionTaskSafe!; - context.Tasks.First().AcceptOutcome(); + await context.Tasks[0].ExecutionTaskSafe!; + context.Tasks[0].AcceptOutcome(); } [Fact] @@ -152,7 +152,7 @@ public async Task TryWaitForCompletedExecutionAsync_SynchronousExecution_Ok() task.Wait(20).Should().BeFalse(); _timeProvider.Advance(TimeSpan.FromDays(1)); await task; - context.Tasks.First().AcceptOutcome(); + context.Tasks[0].AcceptOutcome(); } [Fact] @@ -175,8 +175,8 @@ public async Task TryWaitForCompletedExecutionAsync_HedgedExecution_Ok() _timeProvider.DelayEntries.Last().Delay.Should().Be(hedgingDelay); _timeProvider.Advance(TimeSpan.FromDays(1)); await task; - await context.Tasks.First().ExecutionTaskSafe!; - context.Tasks.First().AcceptOutcome(); + await context.Tasks[0].ExecutionTaskSafe!; + context.Tasks[0].AcceptOutcome(); } [Fact] diff --git a/src/Polly.Core.Tests/Polly.Core.Tests.csproj b/src/Polly.Core.Tests/Polly.Core.Tests.csproj index b055083bccb..b01cacac512 100644 --- a/src/Polly.Core.Tests/Polly.Core.Tests.csproj +++ b/src/Polly.Core.Tests/Polly.Core.Tests.csproj @@ -7,7 +7,7 @@ enable true 100 - $(NoWarn);SA1600;SA1204;SA1602 + $(NoWarn);SA1600;SA1204;SA1602;S6608 [Polly.Core]* diff --git a/src/Polly.Core/Hedging/Controller/HedgingExecutionContext.cs b/src/Polly.Core/Hedging/Controller/HedgingExecutionContext.cs index 719ec1e2cea..7abdb90b4ce 100644 --- a/src/Polly.Core/Hedging/Controller/HedgingExecutionContext.cs +++ b/src/Polly.Core/Hedging/Controller/HedgingExecutionContext.cs @@ -183,7 +183,7 @@ static async Task AwaitTask(TaskExecution task, bool continueOnCapturedCon private TaskExecution? TryRemoveExecutedTask() { - if (_executingTasks.FirstOrDefault(static v => v.ExecutionTaskSafe!.IsCompleted) is TaskExecution execution) + if (_executingTasks.Find(static v => v.ExecutionTaskSafe!.IsCompleted) is TaskExecution execution) { _executingTasks.Remove(execution); return execution;