Describe the bug
When connecting to a SQL Server availability group listener with MultiSubnetFailover=True in the connection string, SqlConnection.Open() hangs indefinitely instead of timing out after the specified ConnectTimeout.
To reproduce
var cs = "Server=mylistener.domain.com;Database=MyDB;MultiSubnetFailover=True;ConnectTimeout=15;Integrated Security=True";
using var conn = new SqlConnection(cs);
conn.Open(); // hangs forever, never times out
The listener has two subnets configured. When one subnet is unreachable, the connection attempt never fails over and never respects the timeout.
Expected behavior
Connection should either succeed by failing over to the reachable subnet, or throw a SqlException after the 15-second ConnectTimeout.
Actual behavior
The call to Open() blocks indefinitely. No exception is thrown. Thread dump shows it stuck in SNI connection attempt.
Further technical details
Microsoft.Data.SqlClient version: 5.2.1
Describe the bug
When connecting to a SQL Server availability group listener with
MultiSubnetFailover=Truein the connection string,SqlConnection.Open()hangs indefinitely instead of timing out after the specifiedConnectTimeout.To reproduce
The listener has two subnets configured. When one subnet is unreachable, the connection attempt never fails over and never respects the timeout.
Expected behavior
Connection should either succeed by failing over to the reachable subnet, or throw a
SqlExceptionafter the 15-secondConnectTimeout.Actual behavior
The call to
Open()blocks indefinitely. No exception is thrown. Thread dump shows it stuck in SNI connection attempt.Further technical details
Microsoft.Data.SqlClient version: 5.2.1