Getting ExtendedSocketException in "th-TH" culture SqlConnection.Open method #1579
Labels
Area\Netcore
Issues that are apply only to .NET runtime or the 'netcore' project folder.
🐛 Bug!
Issues that are bugs in the drivers we maintain.
✔️ Repro Available
Issues that are reproducible with repro provided.
🙌 Up-for-Grabs
Issues that are ready to be picked up for anyone interested. Please self-assign and remove the label
Describe the bug
When the CultureInfo is set to "th-TH", and the SQL Server port (e.g. 1433) is specified in the connection string, the SqlConnection.Open method will fail with ExtendedSocketException. This only happens in .Net Core 3.1 LTS version in Linux.
Below is the part of the verbose log showing the issue:
In above log we can see if using th-TH, the port ",1433" is still being passed to the "serverName" parameter of the "SNITCPHandle..ctor" function, causing DNS query fail:
A good one should look like below if we use zh-CN or don't specify culture:
To reproduce
Below is the sample console app code which can stably reproduce the issue:
sqltest.csproj:
Program.cs:
Expected behavior
It should not contain the port in the "serverName" parameter of the function "SNITCPHandle..ctor", and the DNS should be successful.
Further technical details
Microsoft.Data.SqlClient version: Latest 4.1.0
.NET target: Core 3.1 LTS. (I have tested Core 5.0 and 6.0 and they don't have this problem.)
SQL Server version: Azure Sql Db
Operating system: I tested and can stably repro the issue in my Ubuntu 20.04 LTS in WSL.
Additional context
This may be related to #154
The text was updated successfully, but these errors were encountered: