From aa5cfa0a037e7a0a29a386b98e6274b63c01f086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20St=C4=99pie=C5=84?= <62397363+mariusz96@users.noreply.github.com> Date: Wed, 30 Oct 2024 08:08:56 +0100 Subject: [PATCH] simplify preprocessor directives in async middleware disposal --- src/PipelineNet/AsyncBaseMiddlewareFlow.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PipelineNet/AsyncBaseMiddlewareFlow.cs b/src/PipelineNet/AsyncBaseMiddlewareFlow.cs index e474586..2673aad 100644 --- a/src/PipelineNet/AsyncBaseMiddlewareFlow.cs +++ b/src/PipelineNet/AsyncBaseMiddlewareFlow.cs @@ -81,16 +81,17 @@ internal static async Task DisposeMiddlewareAsync(MiddlewareResolverResult middl if (middleware is IAsyncDisposable asyncDisposable) { await asyncDisposable.DisposeAsync().ConfigureAwait(false); + return; } else -#else - var completedTask = Task.FromResult(0); - await completedTask.ConfigureAwait(false); #endif if (middleware is IDisposable disposable) { disposable.Dispose(); } + + var completedTask = Task.FromResult(0); + await completedTask.ConfigureAwait(false); } } }