Skip to content

Conversation

@edwardneal
Copy link
Contributor

Description

This should cover all necessary functional changes to TdsParser. With these changes merged, the class as a whole should be ready to merge after TdsParserStateObject is dealt with.

Not all of these changes are functional - some are simply necessary to see the real ones clearly. Possibly impactful commits here are:

  • 878fcd4: when TdsParser was writing ints and there was space in the packet buffer, WriteInt would write the bytes to a stackalloc'd Span<byte> and then copy into the buffer. I've eliminated the unnecessary intermediary span, and we now write directly into the buffer.
  • a8be2f1: netfx had more detailed error messages when the parsing of a TDS stream failed. This ports those messages over to netcore.
  • 01b02db: netfx will currently enforce the validation of a server's SSL certificate if Trust Server Certificate is false and the connection's AccessToken or AccessTokenCallback is set, but netcore doesn't currently check the AccessTokenCallback property. This commit changes the behaviour of netcore to match netfx.

There's also one other commit (6d98357) which looks more impactful than it is. s_xmlMetadataSubstituteSequence and s_jsonMetadataSubstituteSequence are the same length, so there's no runtime impact here.

Issues

Relates to #1261.

Testing

Unit tests passed locally.

netcore: removed a simple WriteInt which did nothing besides call BinaryPrimitives.
netcore: when there's space in the packet buffer, WriteInt will now write to it directly (rather than write to a stack-allocated span and copy.)
This removes the need for TdsParser.netcore.cs.
Messages of the netfx exceptions are more detailed
Added mask to netcore logic.
Also removed mask on _encryptionOption from netfx - this will never be outside the range of EncryptionOptions.OPTIONS_MASK.
… is set and certificate is not automatically trusted
This passed state around, but never passed enough state to remove the state machine. Sync with netcore.
@edwardneal edwardneal requested a review from a team as a code owner August 10, 2025 20:33
@paulmedynski paulmedynski self-assigned this Aug 27, 2025
@paulmedynski
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Contributor

@paulmedynski paulmedynski left a comment

Choose a reason for hiding this comment

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

Looks good, with a few questions/suggestions.

Remove unnecessary conditional compilation.
Add XML documentation to clarify SerializeShort, WriteShort et al.
@paulmedynski
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@mdaigle mdaigle self-assigned this Aug 28, 2025
paulmedynski
paulmedynski previously approved these changes Aug 28, 2025
Both platforms will now show the TransparentNetworkIPResolution status. This is always disabled on netcore.
mdaigle
mdaigle previously approved these changes Sep 3, 2025
benrr101
benrr101 previously approved these changes Sep 3, 2025
Copy link
Contributor

@benrr101 benrr101 left a comment

Choose a reason for hiding this comment

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

All looks good to me!

@benrr101
Copy link
Contributor

benrr101 commented Sep 3, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

paulmedynski
paulmedynski previously approved these changes Sep 4, 2025
@paulmedynski
Copy link
Contributor

@edwardneal - I think a merge from main will help clear up some of these CI failures.

@edwardneal edwardneal dismissed stale reviews from paulmedynski, benrr101, and mdaigle via c421d87 September 9, 2025 17:17
@edwardneal
Copy link
Contributor Author

Thanks @paulmedynski - I've just merged, can you re-run CI please?

@paulmedynski
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@paulmedynski
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@codecov
Copy link

codecov bot commented Sep 10, 2025

Codecov Report

❌ Patch coverage is 18.01802% with 182 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.83%. Comparing base (cd3dbd1) to head (c421d87).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
.../netcore/src/Microsoft/Data/SqlClient/TdsParser.cs 12.38% 92 Missing ⚠️
...nt/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs 23.07% 90 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3555      +/-   ##
==========================================
- Coverage   65.48%   61.83%   -3.66%     
==========================================
  Files         275      267       -8     
  Lines       61518    61338     -180     
==========================================
- Hits        40288    37931    -2357     
- Misses      21230    23407    +2177     
Flag Coverage Δ
addons ?
netcore 63.90% <12.38%> (-3.75%) ⬇️
netfx 63.95% <23.07%> (-5.26%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Contributor

@benrr101 benrr101 left a comment

Choose a reason for hiding this comment

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

Let's gooooooooooooooooo 🚀

@benrr101 benrr101 merged commit 1765de5 into dotnet:main Sep 16, 2025
236 checks passed
@edwardneal edwardneal deleted the merge/tdsparser-pt2 branch September 17, 2025 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet