Skip to content

Merge | TdsParser.GetSniErrorDetails #3434

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

edwardneal
Copy link
Contributor

Description

This is a slightly smaller merge, but it's the first of its type.

TdsParser.Windows.cs and TdsParser.Unix.cs have a number of methods which vary in behaviour based upon TdsParserStateObjectFactory.UseManagedSNI. This PR handles those methods by moving the method to the TdsParserStateObject base class, implementing them in the Native and Managed child classes, then updating the references to use the state object.

Once this process is complete, we'll be able to remove the OS-specific TdsParser files.

Issues

Contributes to #1261.

Testing

Unit tests pass locally, but I'd like a CI run please.

@edwardneal edwardneal requested a review from a team as a code owner June 23, 2025 06:50
@benrr101
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

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

Makes perfect sense to me - nice that we will be able to drop these OS-specific files!

@benrr101 benrr101 requested a review from a team June 23, 2025 16:43
@benrr101 benrr101 added Code Health 💊 Issues/PRs that are targeted to source code quality improvements. Common Project 🚮 Things that relate to the common project project labels Jun 23, 2025
@benrr101 benrr101 added this to the 7.0-preview1 milestone Jun 23, 2025
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.

One tiny question.

paulmedynski
paulmedynski previously approved these changes Jun 25, 2025
@paulmedynski
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

samsharma2700
samsharma2700 previously approved these changes Jul 3, 2025
Copy link
Contributor

@samsharma2700 samsharma2700 left a comment

Choose a reason for hiding this comment

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

Changes look great! just a few nits.

{
SniError sniError = SniProxy.Instance.GetLastError();

return new SniErrorDetails(sniError.errorMessage, sniError.nativeError, sniError.sniError, (int)sniError.provider, sniError.lineNumber, sniError.function, sniError.exception);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Please consider chopping these into multiple lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Formatted in both places, with the exception parameter on an extra line for netcore.

{
SniNativeWrapper.SniGetLastError(out SniError sniError);

return new SniErrorDetails(sniError.errorMessage, sniError.nativeError, sniError.sniError, (int)sniError.provider, sniError.lineNumber, sniError.function);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: same here.

@edwardneal edwardneal dismissed stale reviews from samsharma2700 and paulmedynski via d643b06 July 3, 2025 21:06
@paulmedynski
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link

codecov bot commented Jul 4, 2025

Codecov Report

Attention: Patch coverage is 43.10345% with 33 lines in your changes missing coverage. Please review.

Project coverage is 59.63%. Comparing base (12f742d) to head (d643b06).
Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
.../netcore/src/Microsoft/Data/SqlClient/TdsParser.cs 0.00% 18 Missing ⚠️
...nt/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs 0.00% 13 Missing ⚠️
...c/Microsoft/Data/SqlClient/TdsParserStateObject.cs 88.88% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3434      +/-   ##
==========================================
- Coverage   63.51%   59.63%   -3.88%     
==========================================
  Files         293      274      -19     
  Lines       63810    62012    -1798     
==========================================
- Hits        40526    36983    -3543     
- Misses      23284    25029    +1745     
Flag Coverage Δ
addons ?
netcore 61.48% <47.36%> (-5.46%) ⬇️
netfx 63.52% <56.66%> (-2.70%) ⬇️

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Health 💊 Issues/PRs that are targeted to source code quality improvements. Common Project 🚮 Things that relate to the common project project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants