The problem is, after the transaction is commited, the connection is returned to the pool immediatelly
|
case TransactionStatus.Idle: |
|
// Connection is null if a connection enlisted in a TransactionScope was closed before the |
|
// TransactionScope completed - the connector is still enlisted, but has no connection. |
|
Connection?.EndBindingScope(ConnectorBindingScope.Transaction); |
|
break; |
Which is fine (I guess), but NpgsqlTransaction still holds the reference to the connector, which is already in the pool.
The problem is, after the transaction is commited, the connection is returned to the pool immediatelly
npgsql/src/Npgsql/NpgsqlConnector.cs
Lines 1330 to 1334 in ceb8e4f
Which is fine (I guess), but
NpgsqlTransactionstill holds the reference to the connector, which is already in the pool.