From 4e6e2f70f3177ebde56e4c752286a99b0eadc725 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Wed, 10 Dec 2025 07:21:29 -0400 Subject: [PATCH 1/9] - Removed unused dependencies across all driver and test projects. - Updated some dependencies to avoid transitive vulnerabilities. --- ...waysEncrypted.AzureKeyVaultProvider.csproj | 1 - .../ref/Microsoft.Data.SqlClient.csproj | 4 -- .../src/Microsoft.Data.SqlClient.csproj | 2 - .../netfx/ref/Microsoft.Data.SqlClient.csproj | 2 - .../netfx/src/Microsoft.Data.SqlClient.csproj | 2 - .../Microsoft.Data.SqlClient.Tests.csproj | 3 - ....Data.SqlClient.ManualTesting.Tests.csproj | 2 - tools/props/Versions.props | 59 ++++++++++--------- tools/specs/Microsoft.Data.SqlClient.nuspec | 6 -- ...waysEncrypted.AzureKeyVaultProvider.nuspec | 3 - 10 files changed, 32 insertions(+), 52 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj b/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj index d68e3ee661..319716a669 100644 --- a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj +++ b/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj @@ -32,7 +32,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj index 7ef9ff4f78..e509e0c575 100644 --- a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj @@ -42,15 +42,11 @@ - - - - diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj index 77b2470387..f26a65a076 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -963,12 +963,10 @@ - - diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj index 2336768391..848d403b36 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj @@ -85,11 +85,8 @@ - - - diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj index 95a4dd8723..7d2ca3f23c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj @@ -329,7 +329,6 @@ - @@ -338,7 +337,6 @@ - diff --git a/tools/props/Versions.props b/tools/props/Versions.props index b8a6172ba7..4f7f526bcd 100644 --- a/tools/props/Versions.props +++ b/tools/props/Versions.props @@ -1,5 +1,7 @@ + + 5.1.8 0 @@ -12,6 +14,8 @@ $(MdsVersionDefault)-dev $(NugetPackageVersion) + + @@ -21,68 +25,69 @@ 1.0.0-dev $(SqlServerPackageVersion) - + + - 5.1.2 + $(NugetPackageVersion) + $(NugetPackageVersion) - + + + 1.41.0 1.12.1 4.76.0 - 6.35.0 6.35.0 - 4.5.1 - 6.0.1 - 6.0.11 + 6.35.0 + 4.6.1 - + + + + 5.1.2 + + + - 5.0.0 5.1.2 - 6.0.1 1.0.0 - 6.0.1 - 6.0.1 + 6.0.1 6.0.0 - 5.0.0 6.0.0 5.0.0 6.0.0 - + + + 5.0.0 4.3.0 + 5.0.0 + - 1.41.0 4.6.0 6.0.3 4.3.2 - + + - 3.1.6 - 17.12.0 - 13.0.1 - 4.3.0 - 6.0.1 + 17.14.0 + 13.0.4 + 6.0.2 6.0.1 5.0.0 2.9.3 2.8.2 8.0.0-beta.25555.2 11.0.0-beta.25476.3 - 2.0.8 172.52.0 10.50.1600.1 0.13.2 6.0.0 - 6.0.1 + 8.0.1 1.0.3 - - $(NugetPackageVersion) - $(NugetPackageVersion) - diff --git a/tools/specs/Microsoft.Data.SqlClient.nuspec b/tools/specs/Microsoft.Data.SqlClient.nuspec index 274ae7b225..8039fe26e1 100644 --- a/tools/specs/Microsoft.Data.SqlClient.nuspec +++ b/tools/specs/Microsoft.Data.SqlClient.nuspec @@ -39,8 +39,6 @@ When using NuGet 3.x this package requires at least version 3.4. - - - 17.14.0 + 17.12.0 13.0.4 6.0.2 6.0.1 - 5.0.0 2.9.3 2.8.2 8.0.0-beta.25555.2 diff --git a/tools/specs/Microsoft.Data.SqlClient.nuspec b/tools/specs/Microsoft.Data.SqlClient.nuspec index 8039fe26e1..7427f4b830 100644 --- a/tools/specs/Microsoft.Data.SqlClient.nuspec +++ b/tools/specs/Microsoft.Data.SqlClient.nuspec @@ -38,7 +38,7 @@ When using NuGet 3.x this package requires at least version 3.4. - + - - diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj index 7d2ca3f23c..ea59717ef3 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj @@ -323,7 +323,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj index e525bdeda3..4bd155fafe 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj @@ -12,7 +12,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Circle/Circle.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Circle/Circle.csproj index 750ae10973..f18edeec5e 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Circle/Circle.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Circle/Circle.csproj @@ -12,7 +12,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj index d2b894a83d..4e321166ff 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj @@ -12,7 +12,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Utf8String/Utf8String.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Utf8String/Utf8String.csproj index 4b520c0286..4c9c790bbb 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Utf8String/Utf8String.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Utf8String/Utf8String.csproj @@ -12,7 +12,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj index 7219ca2c8b..5306ece191 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj +++ b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj @@ -7,7 +7,13 @@ - + + diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj index 1ca32f6754..7929f589a1 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj +++ b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj @@ -14,8 +14,6 @@ PreserveNewest - - diff --git a/tools/props/Versions.props b/tools/props/Versions.props index 13fe35cdba..a53729d9b0 100644 --- a/tools/props/Versions.props +++ b/tools/props/Versions.props @@ -77,14 +77,13 @@ 17.12.0 13.0.4 6.0.2 - 6.0.1 2.9.3 2.8.2 8.0.0-beta.25555.2 11.0.0-beta.25476.3 172.52.0 10.50.1600.1 - 0.13.2 + 0.14.0 6.0.0 8.0.1 1.0.3 From 222f16c9fa20280544016c95eb2001dc9c0d6a79 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 15 Dec 2025 14:32:13 -0400 Subject: [PATCH 4/9] - Fixed resource strings generation to work on Unix. - Fixed incorrectly cased filenames. - Added CodeQL GitHub workflow. --- .github/workflows/codeql.yml | 94 +++++++++++++++++++ .../{SQLDebugging.xml => SqlDebugging.xml} | 0 .../src/Microsoft.Data.SqlClient.csproj | 4 +- ...nectionString.cs => DbConnectionString.cs} | 0 .../GenerateResourceStringsSource.targets | 17 ++-- ...tadataFactory.cs => SqlMetaDataFactory.cs} | 0 6 files changed, 107 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/codeql.yml rename doc/snippets/Microsoft.Data.SqlClient/{SQLDebugging.xml => SqlDebugging.xml} (100%) rename src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/{DBConnectionString.cs => DbConnectionString.cs} (100%) rename src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/{SqlMetadataFactory.cs => SqlMetaDataFactory.cs} (100%) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000000..51f6558aac --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,94 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Advanced" + +on: + push: + branches: [ "release/5.1" ] + pull_request: + branches: [ "release/5.1" ] + schedule: + - cron: '33 23 * * 6' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: csharp + build-mode: manual + # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v5.0.1 + with: + global-json-file: global.json + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - name: Run manual build steps + if: matrix.build-mode == 'manual' + shell: bash + run: | + mkdir packages + dotnet build src/Microsoft.Data.SqlClient.sln + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{matrix.language}}" diff --git a/doc/snippets/Microsoft.Data.SqlClient/SQLDebugging.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlDebugging.xml similarity index 100% rename from doc/snippets/Microsoft.Data.SqlClient/SQLDebugging.xml rename to doc/snippets/Microsoft.Data.SqlClient/SqlDebugging.xml diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj index 14d20d44a9..e7f82ad14a 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -408,8 +408,8 @@ Microsoft\Data\SqlClient\SqlInternalTransaction.cs - - Microsoft\Data\SqlClient\SqlMetadataFactory.cs + + Microsoft\Data\SqlClient\SqlMetaDataFactory.cs Microsoft\Data\SqlClient\SqlNotificationEventArgs.cs diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/DBConnectionString.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/DbConnectionString.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/DBConnectionString.cs rename to src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/DbConnectionString.cs diff --git a/src/Microsoft.Data.SqlClient/netfx/tools/targets/GenerateResourceStringsSource.targets b/src/Microsoft.Data.SqlClient/netfx/tools/targets/GenerateResourceStringsSource.targets index eb2be2ae9d..1c8bf89865 100644 --- a/src/Microsoft.Data.SqlClient/netfx/tools/targets/GenerateResourceStringsSource.targets +++ b/src/Microsoft.Data.SqlClient/netfx/tools/targets/GenerateResourceStringsSource.targets @@ -1,10 +1,15 @@ - - - - - - + + pwsh + powershell.exe + + + + + + + + diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlMetadataFactory.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlMetaDataFactory.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlMetadataFactory.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlMetaDataFactory.cs From 945a69aa7ce0327b1b11df74d0172155f38c3161 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 15 Dec 2025 14:49:27 -0400 Subject: [PATCH 5/9] - Added global.json for .NET SDK 8.0. --- global.json | 5 +++++ .../netfx/ref/Microsoft.Data.SqlClient.cs | 4 ++-- .../netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 global.json diff --git a/global.json b/global.json new file mode 100644 index 0000000000..68bd8fe2d3 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "8.0.416" + } +} diff --git a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.cs b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.cs index 2a8197448c..ee793aa693 100644 --- a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.cs +++ b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.cs @@ -1385,14 +1385,14 @@ public override void Close() { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] System.Data.IDataReader System.Data.IDataRecord.GetData(int i) { throw null; } } - /// + /// [System.Runtime.InteropServices.ClassInterfaceAttribute(System.Runtime.InteropServices.ClassInterfaceType.None)] [System.Runtime.InteropServices.ComVisibleAttribute(true)] [System.Runtime.InteropServices.GuidAttribute("afef65ad-4577-447a-a148-83acadd3d4b9")] [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name = "FullTrust")] public sealed partial class SQLDebugging { - /// + /// public SQLDebugging() { } } /// diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs index 04acfcb612..238db4f0a5 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs @@ -2998,7 +2998,7 @@ internal byte[] GetBytes(object o, out Format format, out int maxSize) // You must not change the guid for this coclass // or the iid for the ISQLDebug interface // - /// + /// [ ComVisible(true), ClassInterface(ClassInterfaceType.None), From e64eed9b25e93dfec541e30dd3eb5ab403a588fd Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Tue, 16 Dec 2025 07:18:32 -0400 Subject: [PATCH 6/9] - Enhanced logging of TDS Server to see client/server endpoint details. --- .../TDS/TDS.EndPoint/TDSServerEndPoint.cs | 29 ++++++++++++++----- .../TDSServerEndPointConnection.cs | 2 +- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPoint.cs b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPoint.cs index e81139c63a..7c79a282d2 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPoint.cs +++ b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPoint.cs @@ -100,7 +100,7 @@ public void Start() // Update ServerEndpoint with the actual address/port, e.g. if port=0 was given ServerEndPoint = (IPEndPoint)ListenerSocket.LocalEndpoint; - Log($"{GetType().Name} {EndpointName} Is Server Socket Bound: {ListenerSocket.Server.IsBound} Testing connectivity to the endpoint created for the server."); + Log($"Is Server Socket Bound: {ListenerSocket.Server.IsBound} Testing connectivity to the endpoint created for the server."); using (TcpClient client = new TcpClient()) { try @@ -109,18 +109,18 @@ public void Start() } catch (Exception e) { - Log($"{GetType().Name} {EndpointName} Error occurred while testing server endpoint {e.Message}"); + Log($"Error occurred while testing server endpoint {e.Message}"); throw; } } - Log($"{GetType().Name} {EndpointName} Endpoint test successful."); + Log("Endpoint test successful."); // Initialize the listener ListenerThread = new Thread(new ThreadStart(_RequestListener)) { IsBackground = true }; ListenerThread.Name = "TDS Server EndPoint Listener"; ListenerThread.Start(); - Log($"{GetType().Name} {EndpointName} Listener Thread Started "); + Log("Listener Thread Started "); } /// @@ -232,23 +232,36 @@ private void _RequestListener() /// private void _OnConnectionClosed(object sender, EventArgs e) { + T clientConnection = sender as T; + var remoteEndPoint = clientConnection.Connection.Client.RemoteEndPoint; + + bool removed = false; + // Synchronize access to connection collection lock (Connections) { // Remove the existing connection from the list - Connections.Remove(sender as T); - Log($"{GetType().Name} {EndpointName} Connection Closed"); + removed = Connections.Remove(clientConnection); + } + + if (removed) + { + Log($"Connection closed and removed: {remoteEndPoint}"); + } + else + { + Log($"Connection closed but NOT removed (not found): {remoteEndPoint}"); } } /// /// Write a string to the log /// - internal void Log(string text, params object[] args) + internal void Log(string text) { if (EventLog != null) { - EventLog.WriteLine(text, args); + EventLog.WriteLine($"{GetType().Name} {EndpointName} {ServerEndPoint} {text}"); } } } diff --git a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPointConnection.cs b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPointConnection.cs index 6327189691..7a352abe66 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPointConnection.cs +++ b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPointConnection.cs @@ -74,7 +74,7 @@ public abstract class ServerEndPointConnection /// /// Connection itself /// - protected TcpClient Connection { get; set; } + public TcpClient Connection { get; set; } /// /// The flag indicates whether server is being stopped From cac840c48681bfcf0d5baa6aba27d477214ea820 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Wed, 17 Dec 2025 13:56:47 -0400 Subject: [PATCH 7/9] - Fixed NRE in TDS Test server logging. --- .../tools/TDS/TDS.EndPoint/TDSServerEndPoint.cs | 8 ++++---- .../TDS/TDS.EndPoint/TDSServerEndPointConnection.cs | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPoint.cs b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPoint.cs index 7c79a282d2..48e2a46d89 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPoint.cs +++ b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPoint.cs @@ -203,6 +203,8 @@ private void _RequestListener() // Register a new connection Connections.Add(connection); } + + Log($"New connection accepted: {connection.RemoteEndPoint} Total connections: {Connections.Count} "); } catch (Exception ex) { @@ -233,8 +235,6 @@ private void _RequestListener() private void _OnConnectionClosed(object sender, EventArgs e) { T clientConnection = sender as T; - var remoteEndPoint = clientConnection.Connection.Client.RemoteEndPoint; - bool removed = false; // Synchronize access to connection collection @@ -246,11 +246,11 @@ private void _OnConnectionClosed(object sender, EventArgs e) if (removed) { - Log($"Connection closed and removed: {remoteEndPoint}"); + Log($"Connection closed and removed: {clientConnection.RemoteEndPoint}"); } else { - Log($"Connection closed but NOT removed (not found): {remoteEndPoint}"); + Log($"Connection closed but NOT removed (not found): {clientConnection.RemoteEndPoint}"); } } diff --git a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPointConnection.cs b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPointConnection.cs index 7a352abe66..2531edad61 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPointConnection.cs +++ b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPointConnection.cs @@ -76,6 +76,15 @@ public abstract class ServerEndPointConnection /// public TcpClient Connection { get; set; } + /// + /// We copy the remote endpoint so it can be used _after_ the connection + /// is closed. + /// + /// + /// + /// + public System.Net.EndPoint RemoteEndPoint { get; } + /// /// The flag indicates whether server is being stopped /// @@ -89,8 +98,9 @@ public ServerEndPointConnection(ITDSServer server, TcpClient connection) // Save server Server = server; - // Save TCP connection + // Save TCP connection and its remote endpoint. Connection = connection; + RemoteEndPoint = connection.Client.RemoteEndPoint; // Configure timeouts Connection.ReceiveTimeout = 1000; From ea215878bade34fdae76a31b12a525998b1f79e6 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Thu, 18 Dec 2025 10:28:34 -0400 Subject: [PATCH 8/9] - Added System.IdentityModel.Tokens.Jwt as a top-level dependency since we use it directly. - Fixed inconsistent casing for SQLDebugging class and docs. - Removed System.Win32.Registry from .NET nuspec targets since we don't use it. --- .../{SqlDebugging.xml => SQLDebugging.xml} | 0 .../netcore/ref/Microsoft.Data.SqlClient.csproj | 1 + .../netcore/src/Microsoft.Data.SqlClient.csproj | 1 + .../netfx/ref/Microsoft.Data.SqlClient.cs | 4 ++-- .../netfx/ref/Microsoft.Data.SqlClient.csproj | 1 + .../netfx/src/Microsoft.Data.SqlClient.csproj | 1 + .../netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs | 2 +- tools/props/Versions.props | 1 + tools/specs/Microsoft.Data.SqlClient.nuspec | 6 ++++-- 9 files changed, 12 insertions(+), 5 deletions(-) rename doc/snippets/Microsoft.Data.SqlClient/{SqlDebugging.xml => SQLDebugging.xml} (100%) diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlDebugging.xml b/doc/snippets/Microsoft.Data.SqlClient/SQLDebugging.xml similarity index 100% rename from doc/snippets/Microsoft.Data.SqlClient/SqlDebugging.xml rename to doc/snippets/Microsoft.Data.SqlClient/SQLDebugging.xml diff --git a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj index e65154044d..8a8390db69 100644 --- a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj @@ -59,5 +59,6 @@ + diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj index e7f82ad14a..5f07c67dce 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -978,6 +978,7 @@ + diff --git a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.cs b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.cs index ee793aa693..2a8197448c 100644 --- a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.cs +++ b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.cs @@ -1385,14 +1385,14 @@ public override void Close() { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] System.Data.IDataReader System.Data.IDataRecord.GetData(int i) { throw null; } } - /// + /// [System.Runtime.InteropServices.ClassInterfaceAttribute(System.Runtime.InteropServices.ClassInterfaceType.None)] [System.Runtime.InteropServices.ComVisibleAttribute(true)] [System.Runtime.InteropServices.GuidAttribute("afef65ad-4577-447a-a148-83acadd3d4b9")] [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name = "FullTrust")] public sealed partial class SQLDebugging { - /// + /// public SQLDebugging() { } } /// diff --git a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj index 6a88034d1f..14fbe6f4c9 100644 --- a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj @@ -48,5 +48,6 @@ + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index f1d570c937..b6cfedffa7 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -723,6 +723,7 @@ + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs index 238db4f0a5..af2099e6d0 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs @@ -2998,7 +2998,7 @@ internal byte[] GetBytes(object o, out Format format, out int maxSize) // You must not change the guid for this coclass // or the iid for the ISQLDebug interface // - /// + /// [ ComVisible(true), ClassInterface(ClassInterfaceType.None), diff --git a/tools/props/Versions.props b/tools/props/Versions.props index a53729d9b0..b73c99bfa7 100644 --- a/tools/props/Versions.props +++ b/tools/props/Versions.props @@ -40,6 +40,7 @@ 6.35.0 6.35.0 4.6.1 + 6.35.0 diff --git a/tools/specs/Microsoft.Data.SqlClient.nuspec b/tools/specs/Microsoft.Data.SqlClient.nuspec index 7427f4b830..ca48e4d915 100644 --- a/tools/specs/Microsoft.Data.SqlClient.nuspec +++ b/tools/specs/Microsoft.Data.SqlClient.nuspec @@ -39,6 +39,7 @@ When using NuGet 3.x this package requires at least version 3.4. +