Skip to content

Commit f62ac3b

Browse files
For failed connection requests in ConnectionPool in case of PoolBlockingPeriod not enabled, ensure stacktrace of the exception is not swallowed (#1768)
1 parent 50ec923 commit f62ac3b

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/ProviderBase/DbConnectionPool.NetCoreApp.cs

-8
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ namespace Microsoft.Data.ProviderBase
1111
{
1212
sealed internal partial class DbConnectionPool
1313
{
14-
partial void CheckPoolBlockingPeriod(Exception e)
15-
{
16-
if (!IsBlockingPeriodEnabled())
17-
{
18-
throw e;
19-
}
20-
}
21-
2214
private bool IsBlockingPeriodEnabled()
2315
{
2416
var poolGroupConnectionOptions = _connectionPoolGroup.ConnectionOptions as SqlConnectionString;

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/ProviderBase/DbConnectionPool.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,12 @@ private DbConnectionInternal CreateObject(DbConnection owningObject, DbConnectio
776776
throw;
777777
}
778778

779-
CheckPoolBlockingPeriod(e);
779+
#if NETCOREAPP
780+
if (!IsBlockingPeriodEnabled())
781+
{
782+
throw;
783+
}
784+
#endif
780785

781786
// Close associated Parser if connection already established.
782787
if (newObj?.IsConnectionAlive() == true)
@@ -824,9 +829,6 @@ private DbConnectionInternal CreateObject(DbConnection owningObject, DbConnectio
824829
return newObj;
825830
}
826831

827-
//This method is implemented in DbConnectionPool.NetCoreApp
828-
partial void CheckPoolBlockingPeriod(Exception e);
829-
830832
private void DeactivateObject(DbConnectionInternal obj)
831833
{
832834
SqlClientEventSource.Log.TryPoolerTraceEvent("<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> {0}, Connection {1}, Deactivating.", ObjectID, obj.ObjectID);

0 commit comments

Comments
 (0)