From 21e10aee1b0e84a44b97cb3871aaa8550fd42a9a Mon Sep 17 00:00:00 2001 From: Davoud Date: Mon, 25 Mar 2024 14:29:32 -0700 Subject: [PATCH] Regression | Revert PR #2281 SNIProxy code change (#2395) --- .../netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs | 6 +++--- .../ManualTests/SQL/InstanceNameTest/InstanceNameTest.cs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs index d39f382bd6..3df369a2f6 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs @@ -653,10 +653,10 @@ private bool InferConnectionDetails() Port = port; } - // Instance Name Handling. - if (backSlashIndex > -1) + // Instance Name Handling. Only if we found a '\' and we did not find a port in the Data Source + else if (backSlashIndex > -1) { - // This means that there is a part separated by '\' + // This means that there will not be any part separated by comma. InstanceName = tokensByCommaAndSlash[1].Trim(); if (string.IsNullOrWhiteSpace(InstanceName)) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/InstanceNameTest/InstanceNameTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/InstanceNameTest/InstanceNameTest.cs index 205b9d33f1..aa72bb6f5b 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/InstanceNameTest/InstanceNameTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/InstanceNameTest/InstanceNameTest.cs @@ -87,6 +87,7 @@ public static void ConnectManagedWithInstanceNameTest(bool useMultiSubnetFailove } #if NETCOREAPP + [ActiveIssue("27824")] // When specifying instance name and port number, this method call always returns false [ConditionalFact(nameof(IsSPNPortNumberTestForTCP))] public static void PortNumberInSPNTestForTCP() {