diff --git a/XO.Console.Cli.Extensions/CommandAppHostBuilderExtensions.cs b/XO.Console.Cli.Extensions/CommandAppHostBuilderExtensions.cs index 3eff339..2f04e2f 100644 --- a/XO.Console.Cli.Extensions/CommandAppHostBuilderExtensions.cs +++ b/XO.Console.Cli.Extensions/CommandAppHostBuilderExtensions.cs @@ -95,15 +95,19 @@ await DisposeAndFlush(host, loggerFactory) return result; } - private static ValueTask DisposeAndFlush(IHost host, ILoggerFactory? loggerFactory) + private static async ValueTask DisposeAndFlush(IHost host, ILoggerFactory? loggerFactory) { try { if (host is IAsyncDisposable asyncDisposable) - return asyncDisposable.DisposeAsync(); - - host.Dispose(); - return ValueTask.CompletedTask; + { + await asyncDisposable.DisposeAsync() + .ConfigureAwait(false); + } + else + { + host.Dispose(); + } } finally {