Skip to content

[8.0] Fix collection conversion with nullable element converters (#3965) - #3969

Merged
roji merged 1 commit into
hotfix/8.0.12from
roji-nullable-converter-backport-8-0
Oct 15, 2026
Merged

roji merged 1 commit into
hotfix/8.0.12from
roji-nullable-converter-backport-8-0

Conversation

@roji

@roji roji commented Oct 15, 2026

Copy link
Copy Markdown
Member

Backports #3965 (d33cdd4) to hotfix/8.0.12, related to #3919.

Adapt the element conversion lambda's input and output to the collection element types while preserving existing null handling. Retain the array/list round-trip regression tests, using the release branch's existing initializer style. Omit the inherited nullable-comparer query test because it is unavailable in EF8.

Validation: both new regression tests reproduced the original expression-type exception before the fix; all six converter unit tests and 75 focused collection/converter functional tests pass afterward (.NET 8.0.425, PostgreSQL 18).

EF8 limitation: a standalone ToQueryString() reproduction of int[] numbers with numbers.Contains(x.Num.Value) and a ValueConverter<int?, string> now gets past the original converter expression exception, but still fails with a separate MissingMethodException constructing JsonCollectionReaderWriter<int[], int[], int>. This is the nullable JSON reader-writer mismatch reported in #3842 and addressed by #3843, whose JSON mapping fix is absent from EF8. This PR intentionally backports only #3965; it does not include that separate JSON mapping change.

Adapt element conversion input and output nullability while preserving null guards. Backport the array and list regression tests; the inherited nullable-comparer query test is unavailable in EF8.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: cdf2d065-d9c8-4f52-85ea-379a40d76928
@roji
roji merged commit e477d7b into hotfix/8.0.12 Oct 15, 2026
9 checks passed
@roji
roji deleted the roji-nullable-converter-backport-8-0 branch October 15, 2026 12:37
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.

TargetInvocationException when using Contains with non nullable value types with HasConversion

1 participant