[6.1] Propagate Errors from ExecuteScalar#3947
Open
samsharma2700 wants to merge 3 commits intorelease/6.1from
Open
[6.1] Propagate Errors from ExecuteScalar#3947samsharma2700 wants to merge 3 commits intorelease/6.1from
samsharma2700 wants to merge 3 commits intorelease/6.1from
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Ports the fix for #3736 into release/6.1 so ExecuteScalar()/ExecuteScalarAsync() no longer silently ignores server-side errors that arrive after the first row/result, preventing transactional “zombie” scenarios.
Changes:
- Drain remaining result sets in
SqlCommand.CompleteExecuteScalar()(sync) and theExecuteScalarAsyncpath to force pending error tokens to surface. - Add new manual regression tests for
ExecuteScalar/ExecuteScalarAsync, including transactional rollback scenarios. - Update an existing multiple-results manual test to reflect the new error-propagation behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs | Ensures ExecuteScalar (sync/async) drains remaining results so deferred server errors are propagated. |
| src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs | Same ExecuteScalar draining behavior ported to the .NET Framework implementation. |
| src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandExecuteScalarTest.cs | Adds manual regression coverage for conversion-error-after-data and transaction rollback behavior. |
| src/Microsoft.Data.SqlClient/tests/ManualTests/ProviderAgnostic/MultipleResultsTest/MultipleResultsTest.cs | Updates ExecuteScalar test expectations now that ExecuteScalar drains and throws on later errors. |
| src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj | Includes the new manual test file in the test project. |
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandExecuteScalarTest.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs
Show resolved
Hide resolved
...Data.SqlClient/tests/ManualTests/ProviderAgnostic/MultipleResultsTest/MultipleResultsTest.cs
Outdated
Show resolved
Hide resolved
paulmedynski
previously requested changes
Feb 11, 2026
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandExecuteScalarTest.cs
Outdated
Show resolved
Hide resolved
priyankatiwari08
previously approved these changes
Feb 12, 2026
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Contributor
|
@copilot Please create a single PR to address the open conversations. |
Contributor
|
@paulmedynski I've opened a new pull request, #4133, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: paulmedynski <31868385+paulmedynski@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
paulmedynski
reviewed
Apr 2, 2026
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs
Outdated
Show resolved
Hide resolved
Dismissing my request for changes, but not approving.
mdaigle
requested changes
Apr 3, 2026
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs
Outdated
Show resolved
Hide resolved
Contributor
|
/azp run |
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs
Show resolved
Hide resolved
|
Azure Pipelines successfully started running 2 pipeline(s). |
mdaigle
approved these changes
Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Port #3912 to release/6.1 to fix Execute Scalar issue #3736
Issues
Fixes #3736