- 
        Couldn't load subscription status. 
- Fork 316
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| /azp run | 
| Azure Pipelines successfully started running 2 pipeline(s). | 
There was a problem hiding this 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 😄
        
          
                src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this 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 obsolete SmiEventSink_Default class and all its usages, simplifying ValueUtilsSmi calls by dropping the event-sink parameter and cleaning up related code.
- Deleted the SmiEventSink_Defaultclass and its compile includes.
- Updated all ValueUtilsSmicalls inSqlDataRecord, stream classes, and TdsParser to remove the sink parameter.
- Removed the _eventSinkfield and message-processing calls fromSqlDataRecordconstructor.
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description | 
|---|---|
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiEventSink_Default.cs | Deleted 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 _eventSinkusage and updatedValueUtilsSmicalls | 
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiSettersStream.cs | Updated constructor and ValueUtilsSmicalls to drop sink parameter | 
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiGettersStream.cs | Updated constructor and ValueUtilsSmicalls 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 temporary new 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 for SmiEventSink_Default | 
Comments suppressed due to low confidence (2)
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiSettersStream.cs:77
- Consider adding unit tests for SmiSettersStreammethods (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 _recordBufferinitialization is duplicated in both#if NETFRAMEWORKand#elsebranches. You can move it above the directives and only keep the_usesStringStorageForXmlassignment inside the#ifto reduce duplication.
            _recordBuffer = new MemoryRecordBuffer(_columnSmiMetaData);
| /azp run | 
| Azure Pipelines successfully started running 2 pipeline(s). | 
| Codecov ReportAttention: Patch coverage is  
 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     
 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
 | 
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 passed
SmiEventSink_Defaultparameters. The majority of the work is handled in the first three methods.My process here is clearest when considered in the context of SmiEventSink_Default.cs:
ProcessMessagesAndThrowonly does work if called whenHasMessagesis true.HasMessagesis only true if_errorsor_warningsis non-null.ProcessMessages, and in both cases they're set to null.HasMessagesis always false, andProcessMessagesAndThrownever does anything. It can be removed.ProcessMessagesAndThrowwas 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.