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 SmiEventSink_Default#3438

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 11 commits intodotnet:mainfromedwardneal:cleanup/smieventsink
Jun 26, 2025

Conversation

edwardneal
Copy link
Contributor

Description

This follows up#3431 - sorry if I'm treading on your toes here@benrr101. It's a fairly bulky set of changes, but most of this bulk comes from removing the methods in ValueUtilsSmi which accepted and passedSmiEventSink_Default parameters. The majority of the work is handled in the first three methods.

My process here is clearest when considered in the context ofSmiEventSink_Default.cs:

  1. ProcessMessagesAndThrow only does work if called whenHasMessages is true.
  2. HasMessages is only true if_errors or_warnings is non-null.
  3. Both variables are private in scope. They are only ever assigned to inProcessMessages, and in both cases they're set to null.
  4. Based on this,HasMessages is always false, andProcessMessagesAndThrow never does anything. It can be removed.
  5. ProcessMessagesAndThrow was the only member (besides the constructor) accessed on the class.

I thus removed the entire class and every reference to it. This has knock-on effects on SqlDataReader's target-specific files, (which can be merged and removed) but those can be cleaned up later.

Testing

Unit tests and manual tests pass, although I'd appreciate a CI run.

@edwardnealedwardneal requested a review froma team as acode ownerJune 24, 2025 18:05
@benrr101
Copy link
Contributor

/azp run

@azure-pipelinesAzure Pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

benrr101
benrr101 previously approved these changesJun 24, 2025
Copy link
Contributor

@benrr101benrr101 left a comment

Choose a reason for hiding this comment

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

Looks great! One small tweak you can make if you feel like it. No worries about stepping on my toes - I kinda thought I had hit the end of the line for removing SMI code, so I'm extra glad there's more to chuck 😄

@benrr101benrr101 added the Code Health 💊Issues/PRs that are targeted to source code quality improvements. labelJun 24, 2025
@benrr101benrr101 added this to the7.0-preview1 milestoneJun 24, 2025
@benrr101benrr101 requested review froma team andCopilotJune 24, 2025 21:42
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 the obsoleteSmiEventSink_Default class and all its usages, simplifyingValueUtilsSmi calls by dropping the event-sink parameter and cleaning up related code.

  • Deleted theSmiEventSink_Default class and its compile includes.
  • Updated allValueUtilsSmi calls inSqlDataRecord, stream classes, and TdsParser to remove the sink parameter.
  • Removed the_eventSink field and message-processing calls fromSqlDataRecord constructor.

Reviewed Changes

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

Show a summary per file
FileDescription
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiEventSink_Default.csDeleted obsolete event-sink class
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.netfx.cs
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.netcore.cs
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.cs
Removed_eventSink usage and updatedValueUtilsSmi calls
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiSettersStream.csUpdated constructor andValueUtilsSmi calls to drop sink parameter
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiGettersStream.csUpdated constructor andValueUtilsSmi calls to drop sink parameter
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs
src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient/TdsParser.cs
Removed temporarynew SmiEventSink_Default() fromSetCompatibleValueV200
src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj
Removed compile includes forSmiEventSink_Default
Comments suppressed due to low confidence (2)

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiSettersStream.cs:77

  • Consider adding unit tests forSmiSettersStream methods (Flush,SetLength,Write,Seek) to verify correct behavior after removing the event sink parameter.
            _lengthWritten = ValueUtilsSmi.SetBytesLength(_setters, _ordinal, _metaData, _lengthWritten);

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.cs:380

  • [nitpick] The_recordBuffer initialization is duplicated in both#if NETFRAMEWORK and#else branches. You can move it above the directives and only keep the_usesStringStorageForXml assignment inside the#if to reduce duplication.
            _recordBuffer = new MemoryRecordBuffer(_columnSmiMetaData);

@benrr101
Copy link
Contributor

/azp run

@azure-pipelinesAzure Pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@codecovCodecov
Copy link

codecovbot commentedJun 25, 2025
edited
Loading

Codecov Report

Attention: Patch coverage is64.19753% with29 lines in your changes missing coverage. Please review.

Project coverage is 60.14%. Comparing base(b9b9153) to head(910abed).
Report is 10 commits behind head on main.

Files with missing linesPatch %Lines
...c/Microsoft/Data/SqlClient/Server/SqlDataRecord.cs70.00%18 Missing⚠️
...oft/Data/SqlClient/Server/SqlDataRecord.netcore.cs44.44%5 Missing⚠️
...osoft/Data/SqlClient/Server/SqlDataRecord.netfx.cs40.00%3 Missing⚠️
...icrosoft/Data/SqlClient/Server/SmiSettersStream.cs50.00%2 Missing⚠️
...icrosoft/Data/SqlClient/Server/SmiGettersStream.cs66.66%1 Missing⚠️
Additional details and impacted files
@@            Coverage Diff             @@##             main    #3438      +/-   ##==========================================- Coverage   64.70%   60.14%   -4.57%==========================================  Files         280      274       -6       Lines       62174    62065     -109     ==========================================- Hits        40231    37328    -2903- Misses      21943    24737    +2794
FlagCoverage Δ
addons?
netcore63.34% <65.78%> (-3.74%)⬇️
netfx62.18% <66.66%> (-6.03%)⬇️

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 commit100209d intodotnet:mainJun 26, 2025
237 checks passed
@edwardnealedwardneal deleted the cleanup/smieventsink branchJune 27, 2025 04:04
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@samsharma2700samsharma2700samsharma2700 left review comments

Copilot code reviewCopilotCopilot left review comments

@benrr101benrr101benrr101 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.

4 participants
@edwardneal@benrr101@paulmedynski@samsharma2700

[8]ページ先頭

©2009-2025 Movatter.jp