Repository navigation
[6.1.9 Cherry-pick] Validate TDS parser prerequisites and invalidate malformed responses - #4981
Merged
Merged
Conversation
To resolve, run: git cherry-pick b714187
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Backport #4941 for #4981, preserving the release branch parser split. Apply row and alternate-metadata validation to both target implementations and share connection invalidation. Retain 44 simulated-server regressions and register real-server compatibility coverage. Adapt nullable context and pool isolation to release/6.1; omit unsupported pool V2 cases as approved. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
paulmedynski
approved these changes
Nov 16, 2026
paulmedynski
marked this pull request as ready for review
November 16, 2026 16:02
paulmedynski
enabled auto-merge (squash)
November 16, 2026 16:02
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The protocol-parser and connection-invalidation backport needs maintainer review because .NET Framework was compile-only and real-server compatibility tests could not run due to connectivity failures.
No open issues 🎉
What changed in this PR
Backports #4941 to release/6.1 for 6.1.9, adding TDS parser prerequisite checks that reject malformed responses and prevent affected connections from being reused, without changing public APIs.
Changes:
- Validate row metadata, alternate-row identifiers, and SSPI provider state across shared, .NET, and .NET Framework implementations.
- Route invalid prerequisites through the existing corrupted-stream error and connection invalidation path.
- Add 44 simulated-server regression cases and four real-server compatibility cases, excluding unsupported pool V2 scenarios.
| File | Description |
|---|---|
| src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ParserPrerequisiteTests.cs | Adds malformed-response, pool recovery, packet-boundary, and valid-result tests. |
| src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/ParserResultProcessingTest.cs | Adds real-server coverage for nullable rows, result skipping, and connection reuse. |
| src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj | Registers the new compatibility tests. |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDataReader.cs | Validates alternate metadata during reader result transitions. |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Parser/Tokens/TdsAltMetadataCollection.cs | Removes the debug-only failure so callers handle unmatched identifiers consistently. |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Parser/TdsParser.cs | Guards SSPI state and centralizes corrupted-stream rejection. |
| src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Parser/TdsParser.cs | Adds row and alternate-row prerequisite checks for .NET Framework. |
| src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Parser/TdsParser.cs | Adds equivalent prerequisite checks for .NET. |
Review effort: Balanced
benrr101
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Backport #4941 (b714187) to release/6.1 for 6.1.9. The cherry-pick conflicts are resolved, and the branch includes the latest release/6.1 changes.
Issues
Backport of #4941. Resolves the failed automated cherry-pick tracked by this PR.
Testing
dotnet test src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj -p:Configuration=Release -p:NuGetAudit=false --filter 'FullyQualifiedName~ParserPrerequisiteTests|FullyQualifiedName~HasRowsTests|FullyQualifiedName~TdsTokenBoundsTests|FullyQualifiedName~FeatureExtAckBoundsTests' --blame-hang-timeout 10m --logger 'console;verbosity=minimal'-- 276 passed, zero failed/skipped on each of net8.0 and net9.0, including all 44 new parser cases per framework.dotnet build src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj -f net462 -p:TestTargetOS=Windowsnetfx -p:Configuration=Release -p:NuGetAudit=false-- driver and unit tests compile with zero warnings/errors. .NET Framework runtime execution was not performed on Linux.dotnet test src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj -p:Configuration=Release -p:TestSet=2 -p:NuGetAudit=false --filter FullyQualifiedName~ParserResultProcessingTest --blame-hang-timeout 10m --logger 'console;verbosity=minimal'-- compilation succeeded on net8.0/net9.0; all four cases per framework failed during connection opening with a network/instance error, before result assertions.dotnet build src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj -f net462 -p:TestTargetOS=Windowsnetfx -p:Configuration=Release -p:TestSet=2 -p:NuGetAudit=false-- NU1009 in existing test dependencies. Retrying with-p:AutomaticallyUseReferenceAssemblyPackages=falsefailed with MSB3644 (missing Framework targeting assemblies).git diff --cached --checkbefore committing.-p:NuGetAudit=falsefailed because the NuGet vulnerability-data endpoint was unreachable. The property is a local validation workaround only; repository audit settings are unchanged.Guidelines
Please review the contribution guidelines before submitting a pull request: