<PackageReference Include="Microsoft.Identity.Client" Version="4.82.1" />

Microsoft.Identity.Client.Utils.RetryOperationHelper

static class RetryOperationHelper
Provides functionality to automatically try the given piece of logic some number of times before re-throwing the exception. This is useful for any piece of code which may experience transient failures. Be cautious of passing code with two distinct actions given that if the second or subsequent piece of logic fails, the first will also be retried upon each retry.
namespace Microsoft.Identity.Client.Utils { internal static class RetryOperationHelper { public static Task<T> ExecuteWithRetryAsync<T>(Func<Task<T>> func, int maxAttempts, TimeSpan? retryInterval = default(TimeSpan?), Action<int, Exception> onAttemptFailed = null, ISet<Type> allowedExceptions = null); public static Task ExecuteWithRetryAsync(Func<Task> func, int maxAttempts, TimeSpan? retryInterval = default(TimeSpan?), Action<int, Exception> onAttemptFailed = null, ISet<Type> allowedExceptions = null); } }