From a29ccc2908d0070b413dda7afd536633868f51a1 Mon Sep 17 00:00:00 2001 From: martincostello Date: Fri, 1 Mar 2024 14:42:30 +0000 Subject: [PATCH] Fix CA1849 warning Fix CA1849 warning from updating snippets to .NET 9. --- docs/strategies/retry.md | 6 ++---- src/Snippets/Docs/Retry.cs | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) 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/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();