Skip to content

Fix | Make netfx version of SqlCommand.EndExecuteNonQueryAsync private #3460

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 1 commit into
base: main
Choose a base branch
from

Conversation

benrr101
Copy link
Contributor

@benrr101 benrr101 commented Jul 3, 2025

Description

While working on merging SqlCommand, I found this method EndExecuteNonQueryAsync that on the netfx side is private, but on the netcore side is public. Normally I'd just assume that netcore has a new public API, but this one seemed fishy since there are Begin and End methods for the old style async calls, and they normally do not end with Async. So digging into it more, I found that there is no public documentation for the method https://learn.microsoft.com/en-us/dotnet/api/microsoft.data.sqlclient.sqlcommand?view=sqlclient-dotnet-core-6.0 . Furthermore, the docs that are linked in the class do not exist (which is surprising it doesn't throw an error...), and the method is not exposed in the ref project. After consulting with @David-Engel the consensus seems to be to make the method private in netcore.

Issues

Related to #1261

Testing

Made one method private, no changes to functionality at all.

@benrr101 benrr101 added this to the 7.0-preview1 milestone Jul 3, 2025
@Copilot Copilot AI review requested due to automatic review settings July 3, 2025 22:31
@benrr101 benrr101 added the Breaking Change 🔨 Issues/PRs that are related with breaking API changes in the driver. label Jul 3, 2025
@benrr101 benrr101 requested a review from a team as a code owner July 3, 2025 22:31
Copy link
Contributor

@Copilot Copilot AI 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 aligns the visibility of EndExecuteNonQueryAsync in the .NET Core implementation of SqlCommand with the .NET Framework side by making the method private. This removes an unintended public API surface and corrects the XML doc include.

  • Changed the accessibility of EndExecuteNonQueryAsync from public to private.
  • Removed the associated XML doc include for the method.
Comments suppressed due to low confidence (1)

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs:1495

  • Ensure the reference assembly (ref/netcore/.../SqlCommand.cs) and public API documentation are updated to remove or hide this method, so consumers no longer see it as public.
        private int EndExecuteNonQueryAsync(IAsyncResult asyncResult)

Copy link

codecov bot commented Jul 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.58%. Comparing base (df35633) to head (d272d0b).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3460       +/-   ##
===========================================
+ Coverage   63.30%   92.58%   +29.27%     
===========================================
  Files         280        6      -274     
  Lines       62386      310    -62076     
===========================================
- Hits        39493      287    -39206     
+ Misses      22893       23    -22870     
Flag Coverage Δ
addons 92.58% <ø> (ø)
netcore ?
netfx ?

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.

@cheenamalhotra
Copy link
Member

It shouldn't be a breaking change, because:

  • This API is not exposed via reference assembly.
  • This API is not documented anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Change 🔨 Issues/PRs that are related with breaking API changes in the driver.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants