Repository navigation
Small fixes: async disposal in UsingAsync, blank return-parameter names, argument names, one enumeration message - #315
Merged
Conversation
…es, argument names, one enumeration message UsingAsync on a connection factory or a function now disposes the connection the way a connection scope does: DisposeAsync when the connection implements IAsyncDisposable (every DbConnection), Dispose otherwise. It called Dispose before, so a provider's asynchronous disposal was never used. The cost is one type check per call. AddReturnParameter with a DbType, and the SQL Server one with a SqlDbType, now treat an empty or white-space name as no name, as the overload without a type and a null name already did. They threw ArgumentException for a blank name before. AsGeneric on a null IDbConnectionPool now throws ArgumentNullException named connectionPool (it named an internal parameter, source). ToChannel(query, channel) with both arguments null now names the first parameter, source, as the ChannelWriter overload does; it named channel. The message for a second enumeration of a stream is one constant, StallStream.EnumeratedTwiceMessage, used by the row stream and by the chunk stream; the chunk stream had its own text. The tests refer to the constant. The private RowMap method ColumnIndex is renamed OrdinalsByName, so it no longer shares a name with the internal ColumnIndex type. No behavior change. Each behavior change has a test that failed before the change. The release notes list the four changes a caller can see. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…callee, and the pool wrapper's to AsGeneric ToChannel(query, channel) checked the query itself before the call that takes the channel's writer, which checks it again. The first overload now checks only what it uses before the callee does (the channel), with a comment that the query is guarded by the ChannelWriter overload. With both arguments null the exception names the channel again; the test pins that, and the release note for the name is dropped. The private wrapper that AsGeneric makes around a non-generic pool no longer throws for a null pool: AsGeneric, its only caller, checks the argument and names it, and the wrapper asserts it in debug builds. No public API change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts: # docsite/articles/release-notes.md
The theory that checks how a procedure name is split into the restrictions of the schema read used the name dbo.names1. The test helper that gives each test a fresh procedure name hands out dbo.names1 too, as its first name. A qualified name is now remembered for every connection of one kind, so when a test that uses the helper ran first, the theory's call found the names already remembered, read no schema and recorded no restrictions, and the assertion failed. Whether it failed depended on the order the tests ran in, and it did in CI. The theory now uses names the helper never hands out. Tests only: no run-time change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
electricessence
added a commit
that referenced
this pull request
Dec 4, 2026
…en one is fixed (#316) The remembered parameter names of a schema-qualified procedure are kept for the whole process, by server, database, kind of connection and procedure text (#314). Most test fakes reported the same fixed server name (`fake`, `gate`, `output` and so on), so a test could find names another test had left for the same procedure text, and pass or fail by the order the tests ran in. The theory in `ProcedureSchemaNamesTests` that failed in CI on #315 was one such case (#315 renamed its procedure names; this change removes the class of problem). - **Every fake connection reports its own server name.** Each now takes it from `NameServer.Unique`, which already existed. A fake that stands for one server across several connections of one test (the tracked connections of a tally, the connections of a token rig, the connections of a database rig) takes the name once for the tally or rig instead of once per connection, so what a test counts across those connections keeps its meaning. A fake that reports no server at all (the gated connection of the ConfigureAwait test) stays as it is: a connection that names no server is never shared. - **A guard fails when it comes back.** `SharedTierIsolationTests` reads the test project's own source files and fails when a type reports a string literal as its server name (except that one allowed fake, with its reason), or when a test file uses a procedure name of the form `ParameterNameHarness.NewProcedure` hands out (`dbo.names` followed by a number). The failure message says what is wrong and the fix. Seen failing: a fixed `fake` put back in one file and a `dbo.names3` in another made the two checks fail; both were restored before the commit. - **No other channel into the shared table.** `Shared.ByProcedure.Count` is asserted only in the shared-tier collection, which runs alone, and the table is cleared only there. Tests only: no run-time change, no public API change. **Verification:** solution Release build 0 warnings, 0 errors; Core.Tests all passed in three runs with the test classes and collections shuffled (seeds 101, 202 and 303), and in the normal gate; 267 sample checks; style and analyzer checks 0 findings; docfx 0 warnings; style scan clean; each literal of 12 or more characters this change adds appears once. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Small fixes, each with a test that failed before the change.
UsingAsyncon a connection factory or a function disposes asynchronously. It disposes the connection the way a connection scope does:DisposeAsyncwhen the connection implementsIAsyncDisposable(everyDbConnection),Disposeotherwise. It calledDisposebefore, so a provider's asynchronous disposal was never used. All six overloads that dispose a connection they created are covered (IDbConnectionFactory,IDbConnectionFactory<T>, and theFunc<T>forms). Cost: one type check per call.AddReturnParameteris no name. The overload with aDbType, and the SQL Server one with aSqlDbType, treat an empty or white-space name as no name, as the overload without a type and anullname already did. They threwArgumentExceptionbefore.AsGenericon anullIDbConnectionPoolthrowsArgumentNullExceptionnamedconnectionPool(it named an internal parameter,source). The private wrapper it makes no longer checks its argument itself:AsGeneric, its only caller, does, and the wrapper asserts it in debug builds.StallStream.EnumeratedTwiceMessage, used by the row stream and by the chunk stream (which had its own, shorter text). The tests refer to the constant.RowMapmethodColumnIndexisOrdinalsByName, so it no longer shares a name with the internalColumnIndextype.ProcedureSchemaNamesTestsuseddbo.names1, which the test helper that names procedures also hands out first; since qualified names are remembered for every connection of one kind (Share the parameter names of a schema-qualified procedure by server and database #314), it failed in CI when the helper's test ran first. The theory uses names the helper never gives out. Tests only.The release notes list the three changes a caller can see. No public API change (the PublicAPI files are untouched). The
System.Data.SqlClientpackage is left as it is.Tests: 17 new or changed tests; 7 failed on the unfixed code (
UsingAsync1,AddReturnParameter4 across Core and the SQL Server package,AsGeneric1, the chunk stream message 1) and none fail now. One existing test that pinned the old parameter namesourcefor the pool now pinsconnectionPool.Verification: solution Release and Debug (VS MSBuild) 0 warnings, 0 errors; Core.Tests 16229 passed with the generator on, 16208 passed and 16 skipped with it off; 267 sample checks; style and analyzer checks 0 findings on all projects; docfx 0 warnings; style scan clean. Each literal of 12 or more characters this change adds appears once in Source and Tests, apart from the
ParamNamestrings tests pin (connectionPool,connectionFactory) and one repeated XML doc sentence.🤖 Generated with Claude Code