Skip to content

Commit 6085573

Browse files
authored
Fix connection resiliency check (dotnet#310)
1 parent 1a0748e commit 6085573

File tree

1 file changed

+2
-2
lines changed
  • src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient

1 file changed

+2
-2
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ internal Task ValidateAndReconnect(Action beforeDisconnect, int timeout)
11361136
{
11371137
}
11381138
// use Task.Factory.StartNew with state overload instead of Task.Run to avoid anonymous closure context capture in method scope and avoid the unneeded allocation
1139-
runningReconnect = Task.Factory.StartNew(state => ReconnectAsync((int)state), timeout, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
1139+
runningReconnect = Task.Factory.StartNew(state => ReconnectAsync((int)state), timeout, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default).Unwrap();
11401140
// if current reconnect is not null, somebody already started reconnection task - some kind of race condition
11411141
Debug.Assert(_currentReconnectionTask == null, "Duplicate reconnection tasks detected");
11421142
_currentReconnectionTask = runningReconnect;
@@ -1161,7 +1161,7 @@ internal Task ValidateAndReconnect(Action beforeDisconnect, int timeout)
11611161
OnError(SQL.CR_UnrecoverableServer(ClientConnectionId), true, null);
11621162
}
11631163
} // ValidateSNIConnection
1164-
} // sessionRecoverySupported
1164+
} // sessionRecoverySupported
11651165
} // connectRetryCount>0
11661166
}
11671167
else

0 commit comments

Comments
 (0)