diff --git a/Provider/src/FirebirdSql.Data.FirebirdClient/Common/ShutdownHelper.cs b/Provider/src/FirebirdSql.Data.FirebirdClient/Common/ShutdownHelper.cs index 778548ff..cbf7e947 100644 --- a/Provider/src/FirebirdSql.Data.FirebirdClient/Common/ShutdownHelper.cs +++ b/Provider/src/FirebirdSql.Data.FirebirdClient/Common/ShutdownHelper.cs @@ -30,8 +30,8 @@ static ShutdownHelper() _pools = new ConcurrentBag(); _fbClients = new ConcurrentBag(); #if !NETSTANDARD1_6 - AppDomain.CurrentDomain.DomainUnload += (sender, e) => HandleShutdown(); - AppDomain.CurrentDomain.ProcessExit += (sender, e) => HandleShutdown(); + AppDomain.CurrentDomain.DomainUnload += (sender, e) => HandleDomainUnload(); + AppDomain.CurrentDomain.ProcessExit += (sender, e) => HandleProcessShutdown(); #endif } @@ -45,10 +45,15 @@ internal static void RegisterFbClientShutdown(Action item) _fbClients.Add(item); } - static void HandleShutdown() + static void HandleDomainUnload() { foreach (var item in _pools) item(); + } + + static void HandleProcessShutdown() + { + HandleDomainUnload(); foreach (var item in _fbClients) item(); }