Skip to content

[10.0] Fix reading empty multidimensional arrays - #6677

Merged
roji merged 1 commit into
hotfix/10.0.4from
roji-npgsql-10-empty-arrays
Oct 18, 2026
Merged

roji merged 1 commit into
hotfix/10.0.4from
roji-npgsql-10-empty-arrays

Conversation

@roji

@roji roji commented Oct 18, 2026

Copy link
Copy Markdown
Member

Backports only the empty-array rank fix and focused regression test from #6472 (fc81e74), without the converter refactor or unrelated cleanup.

PostgreSQL reports zero dimensions for empty arrays. Preserve the requested CLR rank when creating the result so GetFieldValue<T[,]>() returns an empty multidimensional array instead of throwing InvalidCastException.

Fixes #6675.

Validation against PostgreSQL 18.4:

  • The added regression test failed before the fix in both multiplexing modes.
  • All ArrayTests passed on .NET 8 and .NET 10: 66 passed and 2 skipped per target.
  • EF provider 10.0.3 reproduced the failure with the released driver, then passed empty and nonempty double[,] round-trips with this backport, both directly and through ValueConverter<List<Vertex>, double[,]>, with shape/value assertions.

Validation used NuGetAudit=false because the branch's existing Microsoft.Build.Tasks.Git 8.0.0 advisory otherwise fails restore as a warning-as-error. No dependencies or build configuration were changed.

Backport the empty-array rank fix and regression test from #6472 without the array converter refactor.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 9ed28964-ddbc-4ba3-99af-9428e97d0b7b
@roji
roji force-pushed the roji-npgsql-10-empty-arrays branch from 004c2e9 to 9d5e3ee Compare October 18, 2026 10:55
@roji
roji merged commit f4ab0fd into hotfix/10.0.4 Oct 18, 2026
14 checks passed
@roji
roji deleted the roji-npgsql-10-empty-arrays branch October 18, 2026 11:28
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.

Regression in Npgsql 9: reading an empty multidimensional array throws InvalidCastException

1 participant