Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

6.1.0: Taking a long time to connect #3523

Copy link
Copy link

Description

@chrishardstaff
Issue body actions

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

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
Show more project fields

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.