Skip to content

Fix three inconsistencies found by a final pass over the published packages: the return direction in AddParameter, a canceled parameter-name lookup, and a completed transaction - #321

Merged
electricessence merged 4 commits into
masterfrom
fix/ga-bughunt
Dec 5, 2026
Merged

electricessence merged 4 commits into
masterfrom
fix/ga-bughunt

Conversation

@electricessence

@electricessence electricessence commented Dec 5, 2026 •

Copy link
Copy Markdown
Collaborator

A last review of the published packages looked for the same concept handled two ways. Three inconsistencies were real bugs, each shown by a test that failed before its fix. Each fix is one commit (plus one style-only commit for the test helper), so any of them can be dropped on its own. All three change behavior.

  • AddParameter(name, value, type, direction) accepts a null name for a return value. The overload passed no direction to the check that allows a null name only for ParameterDirection.ReturnValue, so the call threw for a return value although AddParameterType (and the SQL Server overload) accept it. It now passes the direction first and adds an unnamed return parameter; any other direction with a null name still throws ArgumentNullException. The parameter docs now state the rule.
  • A canceled parameter-name lookup is no longer remembered as "no names". When the token was canceled while the provider's GetSchemaAsync threw ArgumentException, NotSupportedException or NotImplementedException, the lookup returned "no names" and kept it, so later calls of that procedure sent the names as written and never looked again. The output-parameter metadata lookup already refused to keep a canceled failure. The name lookup now ends the call with OperationCanceledException and keeps nothing. A failure while the token is not canceled is still "no names".
  • Constructing a command on a completed transaction throws InvalidOperationException. new ExpressiveCommand(transaction, ...), ExpressiveDbCommand, ExpressiveSqlCommand and the Command and StoredProcedure extensions of IDbTransaction and DbTransaction threw ArgumentNullException named connection for a transaction whose connection is gone, while CreateCommand and DbQuery.Using on the same transaction throw InvalidOperationException. They now throw InvalidOperationException with the existing message that names the cause and the fix. A null transaction still throws ArgumentNullException named transaction. The constructor, Command and StoredProcedure exception docs are updated.

Each commit adds its bullet to the release notes.

Checks

  • Core.Tests: Release 16254 passed, Debug 16233 passed and 16 skipped, 0 failed.
  • Each new test fails on the previous base (15 failures in total) and passes with its fix.
  • Solution builds in Release and Debug with 0 warnings; Visual Studio MSBuild 0 errors; samples 267 of 267; docfx builds.
  • dotnet format style and analyzers --severity info: 0 findings in all 14 projects.
  • Roslyn scans: 0 actionable findings; 0 Roslynator findings; the 28 target-framework-specific ones (IDE0370, IDE0390) are the same kind as before.
  • No public API change.

🤖 Generated with Claude Code

electricessence and others added 4 commits December 4, 2026 12:40
…pe, direction)

Old behavior: AddParameter with a null name threw ArgumentNullException for every direction, although its documentation said a null name is allowed for ReturnValue.
New behavior: it passes the direction to AddParameterType, so a null name adds an unnamed return parameter and any other direction still throws; the documentation says so.
Behavior change: yes (a call that threw now succeeds)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Old behavior: when the call was canceled and GetSchemaAsync threw ArgumentException, NotSupportedException or NotImplementedException, the lookup returned no names, which were kept, so later calls never looked again; the canceled call itself ran on with the names as written.
New behavior: when the token is canceled, those failures end the call with OperationCanceledException and nothing is kept, as in the output-parameter metadata lookup; a failure with the token not canceled is still "no names".
Behavior change: yes (only on a canceled call: it ends canceled instead of running on without the looked-up names)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… transaction

Old behavior: the command constructors that take a transaction (and Command and StoredProcedure on a transaction) threw ArgumentNullException named "connection" for a completed transaction.
New behavior: they throw InvalidOperationException with the existing no-connection message, as CreateCommand and DbQuery.Using do; a null transaction still throws ArgumentNullException named "transaction".
Behavior change: yes (the exception type of a completed transaction changes)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Style only: braces on every block, as the repository rules ask. No behavior change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@electricessence
electricessence merged commit 59146a3 into master Dec 5, 2026
9 checks passed
@electricessence
electricessence deleted the fix/ga-bughunt branch December 5, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant