Skip to content

Correct SqlBatch command behavior exception documentation - #4878

Merged
mdaigle merged 1 commit into
mainfrom
dev/mdaigle/sqlbatch-exception-documentation
Oct 20, 2026
Merged

mdaigle merged 1 commit into
mainfrom
dev/mdaigle/sqlbatch-exception-documentation

Conversation

@mdaigle

@mdaigle mdaigle commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Description

SqlBatch.ValidateExecuteCommandBehavior documents NotSupportedException, but invalid or unsupported behavior values throw ArgumentOutOfRangeException. Align the source comment and public XML documentation with the existing contract.

  • Document all accepted batch behaviors: Default, SequentialAccess, CloseConnection, and the combination of the two flags.
  • Use the precise exception type across behavior-taking reader methods and remove the inapplicable entry from the overload without a behavior parameter.
  • Clarify synchronous validation in public ExecuteReaderAsync versus task-based exception reporting in the protected async wrapper.

Documentation only; no runtime behavior, public API signatures, or helper names change.

Issues

Fixes #4823

Testing

  • .\eng\pipelines\onebranch\scripts\validate-xml-docs.ps1 -SnippetsDirectory .\doc\snippets - passed across 99 files. Reported 15 informational unprefixed-cref notices in unrelated snippets.
  • git --no-pager diff --check - passed.
  • Inspected the complete diff to confirm that all four behavior-taking reader sections are consistent and executable code is unchanged.

No unit or integration tests were added or run, and no driver build was run, because this is a documentation-only correction. Existing SqlBatchTest assertions already cover invalid and unsupported values throwing ArgumentOutOfRangeException.

  • Tests added or updated (not applicable: documentation only)
  • Public API changes documented (documentation corrected; signatures unchanged)
  • Verified against customer repro (not applicable: no runtime defect)
  • Ensure no breaking changes introduced

Guidelines

Please review the contribution guidelines before submitting a pull request:

Align validator and reader documentation with ArgumentOutOfRangeException and supported batch behavior values without changing runtime behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ad84379d-8a20-4ea9-adbb-bd206096530a
@mdaigle
mdaigle requested a review from a team as a code owner October 20, 2026 20:14
Copilot AI balanced review requested due to automatic review settings October 20, 2026 20:14
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Oct 20, 2026
@mdaigle mdaigle added this to the 8.0.0-preview1 milestone Oct 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Reported milestone validation failure and pending build checks remain unresolved in the available evidence.

No open issues 🎉

What changed in this PR

Corrects SqlBatch exception documentation to match the existing contract, addressing #4823 without runtime or API changes.

Changes:

  • Lists all supported batch behaviors and their valid combination.
  • Documents ArgumentOutOfRangeException on behavior-taking reader methods.
  • Clarifies synchronous validation versus task-based exception reporting.
File Description
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlBatch.cs Corrects the validation helper’s XML comment.
doc/​snippets/​Microsoft.Data.SqlClient/​SqlBatch.xml Aligns public reader documentation with existing behavior.

Review effort: Balanced

@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.51%. Comparing base (c7ab087) to head (1f1a9cd).
⚠️ Report is 16 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (c7ab087) and HEAD (1f1a9cd). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (c7ab087) HEAD (1f1a9cd)
CI-SqlClient 2 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4878      +/-   ##
==========================================
- Coverage   72.40%   65.51%   -6.90%     
==========================================
  Files         292      286       -6     
  Lines       45471    68617   +23146     
==========================================
+ Hits        32924    44951   +12027     
- Misses      12547    23666   +11119     
Flag Coverage Δ
CI-SqlClient ?
PR-SqlClient-Project 65.51% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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 cheenamalhotra added the Area\Documentation Use this for issues that requires changes in public documentations/samples. label Oct 20, 2026
@cheenamalhotra cheenamalhotra moved this from To triage to In review in SqlClient Board Oct 20, 2026
@mdaigle
mdaigle merged commit c4c2f9e into main Oct 20, 2026
130 of 131 checks passed
@mdaigle
mdaigle deleted the dev/mdaigle/sqlbatch-exception-documentation branch October 20, 2026 22:41
@github-project-automation github-project-automation Bot moved this from In review to Done in SqlClient Board Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Documentation Use this for issues that requires changes in public documentations/samples.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

SqlBatch.ValidateExecuteCommandBehavior XML comment says NotSupportedException but code throws ArgumentOutOfRangeException

4 participants