From 8932db81de8458f5f4f1541953d4ae0c14728306 Mon Sep 17 00:00:00 2001 From: neuecc Date: Wed, 7 Apr 2021 16:44:21 +0900 Subject: [PATCH] support IAsyncDIsposable --- src/ConsoleAppFramework/ConsoleAppEngineService.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ConsoleAppFramework/ConsoleAppEngineService.cs b/src/ConsoleAppFramework/ConsoleAppEngineService.cs index 6dcd1f3..4d373d5 100644 --- a/src/ConsoleAppFramework/ConsoleAppEngineService.cs +++ b/src/ConsoleAppFramework/ConsoleAppEngineService.cs @@ -85,7 +85,14 @@ public async Task StopAsync(CancellationToken cancellationToken) } finally { - scope.Dispose(); + if (scope is IAsyncDisposable asyncDisposable) + { + await asyncDisposable.DisposeAsync(); + } + else + { + scope.Dispose(); + } } } }