Skip to content

Fix stale type names after TDS parser namespace move - #4924

Open
cheenamalhotra wants to merge 2 commits into
mainfrom
dev/cheena/pr-4810-review
Open

cheenamalhotra wants to merge 2 commits into
mainfrom
dev/cheena/pr-4810-review

Conversation

@cheenamalhotra

Copy link
Copy Markdown
Member

Description

Follow-up to #4810. Some string-based references still used old type names, so the compiler did not catch them. This PR fixes them and makes the affected test helpers fail fast.

  • TdsParserStateObjectHelper: use Parser.TdsParserStateObjectManaged; on .NET, assert the type is found.
  • FilteredDefaultTraceListener (stress): use Parser.* stack-frame names; validate frame names at startup.
  • FedAuthTokenHelper:
  • tds-protocol.instructions.md: replace the deleted TdsParserHelperClasses.cs with Parser/Tokens/.
  • TdsParserStateObject.cs: update a type name in a commented-out code example.

No product behavior changes.

Issues

Follow-up to #4810.

Testing

  • dotnet build src/Microsoft.Data.SqlClient/tests/StressTests/SqlClient.Stress.Tests/SqlClient.Stress.Tests.csproj -f net10.0: passed, with 0 warnings.
  • dotnet build src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj -f net10.0: passed, with 0 warnings.
  • A reflection check against the built net10.0 driver confirmed all three stack frames, the SqlFedAuthToken constructor and hash method, and TdsParserStateObjectManaged._sessionHandle resolve.
  • Not run: net462 builds, and AADFedAuthTokenRefreshTest, which needs an Azure managed identity. That test now compares real token hashes instead of "", so it may surface real refresh behavior.

Guidelines

Please review the contribution guidelines before submitting a pull request:

Update reflection, stack-frame and doc references left behind by #4810, and make
the affected test helpers fail fast instead of silently passing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@cheenamalhotra
cheenamalhotra requested a review from a team October 26, 2026 21:51
Copilot AI balanced review requested due to automatic review settings October 26, 2026 21:51
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Oct 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

.NET Framework compatibility and the managed-identity refresh test’s newly effective token-hash comparisons remain unverified.

No open issues 🎉

What changed in this PR

Repairs string-based references left behind by #4810’s TDS parser namespace move and makes affected test helpers fail fast. Product behavior remains unchanged.

Changes:

  • Updates reflection type names and stress-test stack-frame filters, adding lookup validation.
  • Repairs token hashing and removes catch-all blocks that hid reflection failures.
  • Updates the protocol guide and a commented-out reflection example.
File Description
src/​Microsoft.Data.SqlClient/​tests/​StressTests/​SqlClient.Stress.Tests/​FilteredDefaultTraceListener.cs Updates parser frame names and validates their targets.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​Common/​SystemDataInternals/​TdsParserStateObjectHelper.cs Corrects the managed parser type lookup and asserts availability on .NET.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​Common/​SystemDataInternals/​FedAuthTokenHelper.cs Repairs token hashing and exposes reflection errors.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​Parser/​TdsParserStateObject.cs Corrects the type name in a commented-out example only.
.github/​instructions/​tds-protocol.instructions.md Replaces the deleted helper-file reference with token-file documentation.

Review effort: Balanced

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.15%. Comparing base (7b1184b) to head (1035a44).
⚠️ Report is 74 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4924      +/-   ##
==========================================
- Coverage   67.94%   67.15%   -0.79%     
==========================================
  Files         311      308       -3     
  Lines       45399    68824   +23425     
==========================================
+ Hits        30845    46219   +15374     
- Misses      14554    22605    +8051     
Flag Coverage Δ
CI-SqlClient ?
PR-SqlClient-Project 67.15% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@priyankatiwari08 priyankatiwari08 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One stale reflection name left in the sample (inline); other reflection lookups resolve at head.

paulmedynski
paulmedynski previously approved these changes Oct 27, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 4, 2026 02:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The refresh test can fail on a successful token refresh because it incorrectly requires the old and refreshed token hashes to match.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Refresh test incorrectly requires identical token hashes

src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​Common/​SystemDataInternals/​FedAuthTokenHelper.cs:57

Returning the real hash exposes an invalid assertion in FedAuthTokenRefreshTest: it requires the old and refreshed hashes to be identical, although UserAssignedManagedIdentityProvider can acquire a new token. A successful refresh can therefore fail the test solely because the token changed. Update AADFedAuthTokenRefreshTest.cs to verify provider invocation and a later cache expiry without requiring identical token hashes.

Review effort: Balanced

@cheenamalhotra cheenamalhotra added this to the 8.1.0-preview1 milestone Nov 13, 2026
@cheenamalhotra cheenamalhotra added the Hotfix 8.0.0 PRs that must be backported to release/8.0 label Nov 13, 2026
@cheenamalhotra cheenamalhotra moved this from To triage to In review in SqlClient Board Nov 13, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hotfix 8.0.0 PRs that must be backported to release/8.0

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

7 participants