Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cleanup | Remove Dead SMI Code (Part 1)#3393

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
benrr101 merged 8 commits intomainfromdev/russellben/cleanup/smi-dead-code
Jun 11, 2025

Conversation

benrr101
Copy link
Contributor

Description

If I did all of this work in a single PR, I think it would be far too difficult to review. And to be honest, I'm not entirely sure how far down this rabbit hole goes. So, let's start with this and go from there.

While I was working on merging the SMI classes from netfx, I discovered that there was a lot of code that was marked "obsolete" or wasn't being used. This was generally the Context Connection. While I'm not entirely sure what it was supposed to do, there were large swaths of code that would change behavior if the connection was a context connection. However, it all hinged on a property in SqlConnectionString being true -but the property always returns false. So, once I delete that property, large chunks of code become broken. Going through those chunks of code, I see that entire methods and classes can be safely removed since they are no longer being used or doing anything functional.

This PR is structured to follow this thread. Each commit is self-contained and self-explanatory. I delete a chunk of code and anything that becomes unused, I mark with a@TODO. The subsequent commit deletes the code marked with a@TODO. The PR stops when the next batch of deletions start breaking the build.

Issues

N/A

Testing

CI testing should validate that behavior continues as expected. Though theoretically we're just deleting code paths that were never being exercised.

@benrr101benrr101 added this to the6.1.0 milestoneJun 4, 2025
@CopilotCopilotAI review requested due to automatic review settingsJune 4, 2025 23:41
@benrr101benrr101 added the Code Health 💊Issues/PRs that are targeted to source code quality improvements. labelJun 4, 2025
@benrr101benrr101 requested a review froma team as acode ownerJune 4, 2025 23:41
Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes dead code paths tied to the always-falseContextConnection flag and cleans up related SMI/server-side classes and connection logic.

  • Deleted theContextConnection property and all context-connection-specific branches
  • RefactoredSqlConnectionFactory to simplify connection creation and pool options
  • Marked numerous obsolete SMI classes/methods (SmiRequestExecutor,SmiEventStream,SmiContext, etc.) for removal

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
SqlConnectionString.csRemoved always-falseContextConnection property
SmiRequestExecutor.netfx.csFlagged unused methods with@TODO
SmiEventStream.netfx.csAdded@TODO to confirm usage
SmiContext.netfx.csAdded@TODO to identify unused abstractions
SqlInternalConnectionTds.csRemoved obsoleteContextConnection assertion
SqlInternalConnectionSmi.csMarked constructors and methods for deletion
SqlDataReaderSmi.csFlagged unused constructor with@TODO
SqlConnectionFactory.csSimplifiedCreateConnection & pool options logic
SqlConnection.csRemoved context-connection properties and checks
SqlCommand.csEliminated context-connection SMI execution paths
SqlBulkCopy.csRemoved context-connection guard in validation
Comments suppressed due to low confidence (4)

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnectionFactory.cs:40

  • Refactoring of pool group options logic should be accompanied by unit tests to ensure pooling behavior remains correct across all edge cases.
override protected DbConnectionPoolGroupOptions CreateConnectionPoolGroupOptions(DbConnectionOptions connectionOptions)

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlBulkCopy.cs:1326

  • [nitpick] The context-connection guard is marked for deletion; remove this unused block to streamline the method.
// @TODO: No longer used -- delete!

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnectionFactory.cs:140

  • [nitpick] Passing a null literal for the nullablesetEnlistValue parameter can be confusing; consider using a named boolean or introducing an explicit overload to make the intent clearer.
setEnlistValue: null); // Do not modify the enlist value

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnectionFactory.cs:143

  • The updated constructor invocation usesstring.Empty andnull for the password parameters, whereas previously the credential was passed through. Verify that this change preserves the intended authentication behavior.
return new SqlInternalConnectionTds(

@edwardneal
Copy link
Contributor

Great! As a rule of thumb, the context connection removal will eventually result in the removal of almost every file containing "Smi" in the name, and will leave a few of the netfx-specific files unused. It casts a very long shadow, and I think this PR handles the first 10-15%.

Once this is merged I'll update#2996 which should handle a few more parts of the codebase.

benrr101 reacted with rocket emoji

@cheenamalhotracheenamalhotra requested a review froma teamJune 10, 2025 18:08
@codecovCodecov
Copy link

codecovbot commentedJun 10, 2025
edited
Loading

Codecov Report

Attention: Patch coverage is74.62687% with17 lines in your changes missing coverage. Please review.

Project coverage is 68.24%. Comparing base(01f85bf) to head(31f1b2a).
Report is 11 commits behind head on main.

Files with missing linesPatch %Lines
...c/Microsoft/Data/SqlClient/SqlConnectionFactory.cs67.39%15 Missing⚠️
...t/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs85.71%1 Missing⚠️
...etfx/src/Microsoft/Data/SqlClient/SqlConnection.cs92.85%1 Missing⚠️
Additional details and impacted files
@@             Coverage Diff             @@##             main    #3393       +/-   ##===========================================- Coverage   92.58%   68.24%   -24.34%===========================================  Files           6      300      +294       Lines         310    65412    +65102     ===========================================+ Hits          287    44639    +44352- Misses         23    20773    +20750
FlagCoverage Δ
addons92.58% <ø> (ø)
netcore72.42% <ø> (?)
netfx66.98% <74.62%> (?)

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.

@benrr101benrr101 merged commit7c5bd05 intomainJun 11, 2025
251 checks passed
@benrr101benrr101 deleted the dev/russellben/cleanup/smi-dead-code branchJune 11, 2025 22:58
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@mdaiglemdaiglemdaigle approved these changes

@paulmedynskipaulmedynskipaulmedynski approved these changes

Assignees
No one assigned
Labels
Code Health 💊Issues/PRs that are targeted to source code quality improvements.
Projects
None yet
Milestone
6.1-preview2
Development

Successfully merging this pull request may close these issues.

5 participants
@benrr101@edwardneal@mdaigle@paulmedynski@cheenamalhotra

[8]ページ先頭

©2009-2025 Movatter.jp