Repository navigation
Merge pull request #378 from pengdows/fix/prepare-requires-open-connection - #378
Merged
Giorgi merged 2 commits intoOct 20, 2026
Merged
Conversation
IDbCommand.Prepare documents InvalidOperationException when "The Connection is not set. -or- The Connection is not Open()." Prepare was an empty method, so a command with no usable connection passed it and failed only when it executed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Can you resolve the conflict? |
Coverage Report for CI Build 39421145951Coverage increased (+0.02%) to 92.577%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
Contributor
Author
|
The merge conflict has been resolved and the branch is synchronized. Build and CodeQL are passing; thanks for flagging it. |
This branch is waiting to be deployed
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.
DuckDBCommand.Prepare()is an empty method, so it succeeds on a command with no connection or a closed one.The contract
IDbCommand.Prepare, Exceptions:
Change
Prepare()now calls the existingEnsureConnectionOpen(), the same check theExecute*methods use. Statements are still prepared at execution, so an open connection sees no difference. Test:PrepareThrowsWithoutAnOpenConnection(no connection, a closed connection, and an open one). The full suite passes.The same page notes that "there is no need to call this method directly", so this matters most to code that calls
Prepare()up front to catch a misconfigured command early. I've kept it separate from the other contract fixes so you can take or leave it on its own.Conformance tests:
Prepare_throws_when_no_connection,Prepare_throws_when_connection_closed.Found by the pengdows ADO.NET conformance suite, which runs the documented
System.Data.Commoncontract against every provider; each failure it reports cites the learn.microsoft.com sentence the provider departs from.🤖 Generated with Claude Code