diff --git a/docs/strategies/retry.md b/docs/strategies/retry.md index a93b6f74546..c826dad27ee 100644 --- a/docs/strategies/retry.md +++ b/docs/strategies/retry.md @@ -710,17 +710,15 @@ var ctsKey = new ResiliencePropertyKey("cts"); var retry = new ResiliencePipelineBuilder() .AddRetry(new() { - OnRetry = args => + OnRetry = async args => { if (args.Outcome.Exception is TimeoutException) { if (args.Context.Properties.TryGetValue(ctsKey, out var cts)) { - cts.Cancel(); + await cts.CancelAsync(); } } - - return ValueTask.CompletedTask; } }) .Build(); diff --git a/samples/DependencyInjection/DependencyInjection.csproj b/samples/DependencyInjection/DependencyInjection.csproj index f4628e7cdee..a588bb35037 100644 --- a/samples/DependencyInjection/DependencyInjection.csproj +++ b/samples/DependencyInjection/DependencyInjection.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 enable enable diff --git a/samples/GenericPipelines/GenericPipelines.csproj b/samples/GenericPipelines/GenericPipelines.csproj index ee418caeadd..0dea364499d 100644 --- a/samples/GenericPipelines/GenericPipelines.csproj +++ b/samples/GenericPipelines/GenericPipelines.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 enable enable @@ -10,5 +10,5 @@ - + diff --git a/samples/Intro/Intro.csproj b/samples/Intro/Intro.csproj index 8321197231a..499481d3d4e 100644 --- a/samples/Intro/Intro.csproj +++ b/samples/Intro/Intro.csproj @@ -2,13 +2,13 @@ Exe - net7.0 + net8.0 enable enable - + diff --git a/samples/Retries/Retries.csproj b/samples/Retries/Retries.csproj index 201d8ee38e0..499481d3d4e 100644 --- a/samples/Retries/Retries.csproj +++ b/samples/Retries/Retries.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 enable enable diff --git a/src/Snippets/Docs/Retry.cs b/src/Snippets/Docs/Retry.cs index c94afb17f62..e31ac2856bc 100644 --- a/src/Snippets/Docs/Retry.cs +++ b/src/Snippets/Docs/Retry.cs @@ -402,17 +402,15 @@ public static void AntiPattern_CancellingRetry() var retry = new ResiliencePipelineBuilder() .AddRetry(new() { - OnRetry = args => + OnRetry = async args => { if (args.Outcome.Exception is TimeoutException) { if (args.Context.Properties.TryGetValue(ctsKey, out var cts)) { - cts.Cancel(); + await cts.CancelAsync(); } } - - return ValueTask.CompletedTask; } }) .Build(); diff --git a/src/Snippets/Snippets.csproj b/src/Snippets/Snippets.csproj index cd6edde1986..efcf28ecefb 100644 --- a/src/Snippets/Snippets.csproj +++ b/src/Snippets/Snippets.csproj @@ -2,7 +2,7 @@ Library - net7.0 + net8.0 enable enable Library diff --git a/test/Polly.Specs/Retry/WaitAndRetryForeverAsyncSpecs.cs b/test/Polly.Specs/Retry/WaitAndRetryForeverAsyncSpecs.cs index 2516619892f..6ab4b3e65ed 100644 --- a/test/Polly.Specs/Retry/WaitAndRetryForeverAsyncSpecs.cs +++ b/test/Polly.Specs/Retry/WaitAndRetryForeverAsyncSpecs.cs @@ -86,7 +86,7 @@ public void Should_throw_when_sleep_duration_provider_int_context_timespan_is_nu { Action policy = () => Policy .Handle() - .WaitAndRetryForeverAsync(default(Func), default(Action)); + .WaitAndRetryForeverAsync(default, default(Action)); policy.Should().Throw().And .ParamName.Should().Be("sleepDurationProvider");