Repository navigation
Pre-Login timeout #4418
Description
Activity
🔍 Triage Summary
Check Result Issue type Bug Environment ⚠️ Missing: SqlClient version, .NET target framework, SQL Server version, Operating system, repro codeArea Area\Native SNIDuplicates Potentially related: #3118, #2005 Regression Likely regression — reporter states "after upgrading to the latest version" but no prior version specified Analysis
This issue reports a connection timeout during the TDS pre-login phase, where
initializationtakes ~16 seconds (well over the default 15-second connection timeout), causing the connection to fail. The two workarounds — increasingConnection Timeoutto 60 seconds, or switching to managed networking viaAppContext.SetSwitch("Switch.Microsoft.Data.SqlClient.UseManagedNetworkingOnWindows", true)— strongly point to the native SNI code path on Windows as the root cause: since managed SNI resolves the issue, the delay is almost certainly introduced in the native SNI pre-login initialization routine (possibly DNS resolution, socket setup, or TLS negotiation). Severity: P2 — connections fail with default settings but usable workarounds exist.Next Steps
@paxhj1990-stack, please provide the following details so we can investigate:
- Microsoft.Data.SqlClient version (e.g.,
5.2.2,6.0.0) — found on the NuGet package orMicrosoft.Data.SqlClient.dllfile properties - Version you upgraded from (the last version where connections worked)
- .NET target framework (e.g.,
.NET Framework 4.8,.NET 8.0,.NET 9.0) - SQL Server version (e.g., SQL Server 2019, Azure SQL Database)
- Operating system (e.g., Windows 11, Windows Server 2022)
- A minimal repro — a short code snippet or connection string (redact credentials) that reproduces the timeout
Once environment details are provided, this should be assigned to the Copilot coding agent to investigate the native SNI pre-login initialization timing difference relative to managed SNI, with focus on socket setup and TLS negotiation in the native SNI path.
Note: This triage summary is auto-generated by an AI agent. The analysis and suggestions above have not been verified by a human maintainer. Please treat as preliminary guidance only.
Generated by SqlClient Issue Auto-Triage for issue #4418 · 35.3 AIC · ⌖ 7.05 AIC · ⊞ 8.4K · ◷
- Microsoft.Data.SqlClient version (e.g.,
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Connection timeout after upgrading to the latest version: Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=16155; handshake=33;
If add Connection Timeout=60 to the connection string, the connection can succeed; alternatively, using AppContext.SetSwitch("Switch.Microsoft.Data.SqlClient.UseManagedNetworkingOnWindows", true); can also make the connection succeed.