Skip to content

[8.0] Fix ownership of cloned and administrative connections - #4057

Merged
roji merged 1 commit into
hotfix/8.0.12from
roji-connection-ownership-8-0
Oct 20, 2026
Merged

roji merged 1 commit into
hotfix/8.0.12from
roji-connection-ownership-8-0

Conversation

@roji

@roji roji commented Oct 20, 2026

Copy link
Copy Markdown
Member

Backports the complete fix from #3565 (#3565).

Fixes #1814 (#1814).

  • Make CloneWith and both data-source/supplied-connection CreateAdminConnection branches own their newly cloned connections.
  • Clear a previously configured data source in WithConnection(DbConnection?, bool owned) so the supplied connection takes precedence.
  • Adapt the focused regression coverage to 8.0's DbDataSource property and synchronous CloneWith, covering sync/async disposal and preserving caller-owned connections/data sources.

No dependency upgrades or unrelated database-existence/cleanup changes.

Validation: dotnet test test/EFCore.PG.Tests/EFCore.PG.Tests.csproj --no-restore --filter FullyQualifiedName~NpgsqlRelationalConnectionTest --verbosity minimal — 18 passed, 1 pre-existing skip. All 8 regression cases failed before the product fix and passed afterward.

Backport the complete fix from #3565, retaining synchronous cloning and the existing 8.0 connection cleanup.

Co-authored-by: Marcus Bernander <marcusber@users.noreply.github.com>
Co-authored-by: Shay Rojansky <roji@roji.org>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 92d45eab-d040-4405-98b3-d3bc2ab14bc8
@roji roji linked an issue Oct 20, 2026 that may be closed by this pull request
@roji
roji merged commit 2054ae7 into hotfix/8.0.12 Oct 20, 2026
9 checks passed
@roji
roji deleted the roji-connection-ownership-8-0 branch October 20, 2026 14:35
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.

CloneWith and CreateAdminConnection should own newly created connections

1 participant