-
Notifications
You must be signed in to change notification settings - Fork 324
6.1.0: Taking a long time to connect #3523
Copy link
Copy link
Labels
Regression 💥Issues that are regressions introduced from earlier PRs.Issues that are regressions introduced from earlier PRs.Repro Available ✔️Issues that are reproducible with repro provided.Issues that are reproducible with repro provided.
Milestone
Description
Describe the bug
When connecting to a remote server, version 6.1.0 is taking significantly longer than 6.0.2
using Microsoft.Data.SqlClient;
namespace SqlServerConnectTest
{
internal class Program
{
static void Main(string[] args)
{
var builder = new SqlConnectionStringBuilder();
builder.DataSource = "xxx";
builder.InitialCatalog = "xxx";
builder.UserID = "xxx";
builder. Password = "xxx";
builder.TrustServerCertificate = true;
builder.ApplicationName = "Connection test";
builder.ConnectTimeout = 30;
builder.Encrypt = true;
Console.WriteLine(builder.ConnectionString);
using (var cn = new SqlConnection(builder.ConnectionString))
{
try
{
var stopwatch = System.Diagnostics.Stopwatch.StartNew();
cn.Open();
stopwatch.Stop();
Console.WriteLine("Connection successful!");
Console.WriteLine($"Time taken to connect: {stopwatch.ElapsedMilliseconds} ms");
}
catch (SqlException ex)
{
Console.WriteLine($"SQL Error: {ex.Message}");
}
catch (Exception ex)
{
Console.WriteLine($"General Error: {ex.Message}");
}
}
}
}
}When running 6.0.2 on my system this took 948ms, in 6.1.0ms this takes 16494 ms. This is running in .NET 9 and the SQL Server is 2019.
Expected behavior
The connection should happen in roughly the same time on both versions
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Regression 💥Issues that are regressions introduced from earlier PRs.Issues that are regressions introduced from earlier PRs.Repro Available ✔️Issues that are reproducible with repro provided.Issues that are reproducible with repro provided.
Type
Projects
Status
Done