<PackageReference Include="Polly.Core" Version="8.5.1" />

BridgeComponentBase

using System; using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace Polly.Utils.Pipeline { [NullableContext(1)] [Nullable(0)] internal abstract class BridgeComponentBase : PipelineComponent { private readonly object _strategy; protected BridgeComponentBase(object strategy) { _strategy = strategy; } public override ValueTask DisposeAsync() { IAsyncDisposable asyncDisposable = _strategy as IAsyncDisposable; if (asyncDisposable != null) return asyncDisposable.DisposeAsync(); (_strategy as IDisposable)?.Dispose(); return default(ValueTask); } } }