<PackageReference Include="Polly.Core" Version="8.0.0-alpha.6" />

DisposeHelper

static class DisposeHelper
using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace Polly.Utils { internal static class DisposeHelper { [System.Runtime.CompilerServices.NullableContext(1)] [AsyncStateMachine(typeof(<TryDisposeSafeAsync>d__0<>))] public static ValueTask TryDisposeSafeAsync<[System.Runtime.CompilerServices.Nullable(2)] T>(T value, bool isSynchronous) { <TryDisposeSafeAsync>d__0<T> stateMachine = default(<TryDisposeSafeAsync>d__0<T>); stateMachine.<>t__builder = AsyncValueTaskMethodBuilder.Create(); stateMachine.value = value; stateMachine.isSynchronous = isSynchronous; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } } }