diff --git a/src/EFCore.PG/Storage/Internal/NpgsqlDatabaseCreator.cs b/src/EFCore.PG/Storage/Internal/NpgsqlDatabaseCreator.cs index 4034f5ef2..318278246 100644 --- a/src/EFCore.PG/Storage/Internal/NpgsqlDatabaseCreator.cs +++ b/src/EFCore.PG/Storage/Internal/NpgsqlDatabaseCreator.cs @@ -354,7 +354,7 @@ public override void CreateTables() { npgsqlConnection.ReloadTypes(); } - catch + finally { npgsqlConnection.Close(); } @@ -396,7 +396,7 @@ await Dependencies.MigrationCommandExecutor.ExecuteNonQueryAsync(commands, conne { await npgsqlConnection.ReloadTypesAsync(cancellationToken).ConfigureAwait(false); } - catch + finally { await npgsqlConnection.CloseAsync().ConfigureAwait(false); }