Skip to content

Change TryReadString to use TryReadBytesWithContinue #3422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 24, 2025

Conversation

Wraith2
Copy link
Contributor

@Wraith2 Wraith2 commented Jun 15, 2025

Fixes #3421

Digging into the replication provided I found that if the data type of the string column were changed from ntext to nvarchar(max) everything worked as expected. The reason for this is that the two types are handled differently internally despite being value equivalent to the user. nvarchar() is a plp type and ntext is not. non-plp strings pass through the TryReadString function and it was tripping up when hitting the continue point because it had not been altered to deal with it.

TryReadString was using TryReadByteArray and in previous work I have written a version of this which encapsulates continue capable logic, TryReadByteArrayWithContinue. I moved this method down from TdsParser to TdsParserStateObject so it sits at the same level as the original method and then called it from TryReadString. This resolves the problem with minimal changes and no new code.

  • The ability to use the existing api with minor rearrangements is pleasing and I think promising that we've got all the tools we need to handle continue.
  • The code coverage for strings is alarming. I thought that we would have a lot better coverage than we seem to. Strings are a very common path and yet we've found at least 3 combinations that I would have expected to have coverage.
  • This really need to go into Preview 2 to make sure anyone testing the preview has as many fixes as possible and that we pick up any new issues cleanly with preview2. @dotnet/sqlclientdevteam @David-Engel

/cc @ErikEJ @Kobuntu

@Wraith2 Wraith2 requested a review from a team as a code owner June 15, 2025 22:56
@paulmedynski
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@paulmedynski paulmedynski added Bug! 🐛 Issues that are bugs in the drivers we maintain. P2 Use to label moderate priority issue - impacts atleast more than 1 customer. labels Jun 16, 2025
@paulmedynski paulmedynski added this to the 6.1-preview2 milestone Jun 16, 2025
paulmedynski
paulmedynski previously approved these changes Jun 16, 2025
@cheenamalhotra
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Contributor

@ErikEJ ErikEJ left a comment

Choose a reason for hiding this comment

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

LGTM

cheenamalhotra
cheenamalhotra previously approved these changes Jun 18, 2025
Copy link
Member

@cheenamalhotra cheenamalhotra left a comment

Choose a reason for hiding this comment

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

Small change to remove old cleanup query, rest LGTM!

benrr101
benrr101 previously approved these changes Jun 18, 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.

Low stakes comments on the test more than anything

@cheenamalhotra cheenamalhotra removed the Bug! 🐛 Issues that are bugs in the drivers we maintain. label Jun 19, 2025
paulmedynski
paulmedynski previously approved these changes Jun 20, 2025
@Wraith2 Wraith2 dismissed stale reviews from paulmedynski, benrr101, and cheenamalhotra via 6f66457 June 21, 2025 10:12
@paulmedynski
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

paulmedynski
paulmedynski previously approved these changes Jun 22, 2025
@cheenamalhotra
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link

codecov bot commented Jun 24, 2025

Codecov Report

Attention: Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Project coverage is 62.70%. Comparing base (1058566) to head (a8862a9).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...nt/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (1058566) and HEAD (a8862a9). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (1058566) HEAD (a8862a9)
addons 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3422      +/-   ##
==========================================
- Coverage   68.43%   62.70%   -5.73%     
==========================================
  Files         299      285      -14     
  Lines       65418    63321    -2097     
==========================================
- Hits        44766    39706    -5060     
- Misses      20652    23615    +2963     
Flag Coverage Δ
addons ?
netcore 67.00% <100.00%> (-5.57%) ⬇️
netfx 61.87% <95.00%> (-5.30%) ⬇️

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.

@benrr101 benrr101 merged commit 44762d9 into dotnet:main Jun 24, 2025
237 checks passed
@Wraith2 Wraith2 deleted the fix-3421 branch June 24, 2025 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Use to label moderate priority issue - impacts atleast more than 1 customer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TdsParser: Fatal connection error
6 participants