Skip to content

Conversation

benrr101
Copy link
Contributor

@benrr101 benrr101 commented May 2, 2025

Description: This PR is a bit bigger than usual, but it's mostly cut/paste of classes from the netfx project to the common project. There are a few additional changes going on in this PR though that are worth calling out:

  • Some light cleanup of SmiContextFactory to just make sure it's following some style guidelines
  • Making SmiEventStream.Dispose obsolete (since it is notated to be obsolete and only throws)
  • Removing majority of the code in SmiRequestExecutor since it is notated as obsolete and should have never been used.
    • This class is weird - it abstract and used in SqlCommand, but there are no classes that inherit from it. All the virtual code paths overridden in it throw, so any codepath that uses it will always throw. I suspect it is ultimately not used. I will investigate if this entire codepath can be deleted.
  • TriggerAction enum definitions derive directly from EMDEventType enum definitions, which seems completely pointless to me. So, I rolled the EMDEventType values into the TriggerAction enum and deleted EMDEventType.
  • The two SmiXetterAccessMap classes were combined together with #if NETFRAMEWORK.
  • Renamed SmiEventSink_DeferedProcessing to SmiEventSink_DeferredProcessing (typo in Deferred)

Testing: Project builds locally, will wait for CI to call it good.

@benrr101 benrr101 added the Common Project 🚮 Things that relate to the common project project label May 2, 2025
@benrr101 benrr101 added this to the 6.1-preview2 milestone May 2, 2025
@benrr101 benrr101 requested a review from a team May 2, 2025 18:40
Copy link

codecov bot commented May 2, 2025

Codecov Report

Attention: Patch coverage is 0.93458% with 106 lines in your changes missing coverage. Please review.

Project coverage is 65.10%. Comparing base (965e5ff) to head (1b1ca6c).
Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
...rosoft/Data/SqlClient/Server/SmiXetterAccessMap.cs 0.00% 86 Missing ⚠️
...t/Data/SqlClient/Server/SmiContextFactory.netfx.cs 11.11% 8 Missing ⚠️
.../Data/SqlClient/Server/SmiRequestExecutor.netfx.cs 0.00% 5 Missing ⚠️
...osoft/Data/SqlClient/Server/SmiConnection.netfx.cs 0.00% 4 Missing ⚠️
...t/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs 0.00% 1 Missing ⚠️
...nt/Server/SmiEventSink_DeferredProcessing.netfx.cs 0.00% 1 Missing ⚠️
...soft/Data/SqlClient/Server/SmiEventStream.netfx.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3326      +/-   ##
==========================================
- Coverage   67.74%   65.10%   -2.64%     
==========================================
  Files         298      298              
  Lines       65536    65469      -67     
==========================================
- Hits        44397    42624    -1773     
- Misses      21139    22845    +1706     
Flag Coverage Δ
addons 92.58% <ø> (ø)
netcore 68.37% <0.00%> (-3.78%) ⬇️
netfx 66.24% <0.93%> (+0.08%) ⬆️

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.

@edwardneal
Copy link
Contributor

I'm pretty sure that everything here will be deleted when the context connection PR set (#2996 and its follow-ups) is finished. Every path here is already unused because we block context connections in the connection string. Do you still want to merge the files?

I completely agree with removing the event sink code from SqlCommand. I think the original SQLCLR methodology had a set of custom event sinks and a custom SmiLink derivative in the SqlAccess assembly, so it's used to support that.

@benrr101
Copy link
Contributor Author

benrr101 commented May 5, 2025

I'm pretty sure that everything here will be deleted when the context connection PR set (#2996 and its follow-ups) is finished. Every path here is already unused because we block context connections in the connection string. Do you still want to merge the files?

I completely agree with removing the event sink code from SqlCommand. I think the original SQLCLR methodology had a set of custom event sinks and a custom SmiLink derivative in the SqlAccess assembly, so it's used to support that.

nooooooooooooooooooooooooooooooooooooooooooooooooooooooo 😭
I just "discovered" that almost all of the context connection code can be obliterated. And i was really excited to blow it all up ☹️ However, I'm not super sure about all of it being exploded. There's some code paths that are moved in this PR that I can't confidently say are not being used (eg, abstract classes that are never inherited from, but they are still being referenced in a way I can't safely say is never called). I mean for my own satisfaction/ego, I'd like to do the merge and then pare it away in future PRs. But I also want to be nice to our wonderful contributors and let them get the glory when they deserve it.

// SqlDbTypes as rows
// bool, byte, bytes, chars, strng, int16, int32, int64, singl, doubl, sqldec, date, guid, varmd, Xetr, time, dtost
/*BigInt*/ { _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, _, _, },
/*Binary*/ { _, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, },
Copy link
Contributor

Choose a reason for hiding this comment

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

This is some crazy stuff 😟

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's crazier - a lot of this is just going to disappear in a later PR :)

@@ -405,7 +405,7 @@ internal override void ParameterAvailable(SmiParameterMetaData metaData, SmiType

private SmiContext _smiRequestContext; // context that _smiRequest came from
private CommandEventSink _smiEventSink;
private SmiEventSink_DeferedProcessing _outParamEventSink;
private SmiEventSink_DeferredProcessing _outParamEventSink;
Copy link
Contributor

Choose a reason for hiding this comment

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

Heh, I changed this on another branch of mine as well. Shouldn't conflict.

/// <summary>
/// Formal encoding of SMI's metadata-to-ITypedSetter/-from-ITypedGetter validity rules
/// </summary>
internal partial class SmiXetterAccessMap
Copy link
Contributor

Choose a reason for hiding this comment

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

What's a Xetter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Afaik it's [G|S]etter - so this has both getters and setters

@benrr101 benrr101 merged commit b3a72fc into main May 12, 2025
251 checks passed
@benrr101 benrr101 deleted the dev/russellben/merge/netfx-smi branch May 12, 2025 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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