Skip to content

Conversation

@roji
Copy link
Member

@roji roji commented Nov 26, 2025

Fixes #37216

Description

EF 10 made important improvements around the translation of parameterized collections (docs): when a parameter collection is used, rather than sending it as a JSON array (which resulted in performance issues), we now inline it as a set of parameters into the SQL. Unfortunately, the SQL construct for this (VALUES) does not support empty sets, leading to a query failure when the parameterized collection is empty.

Customer impact

Queries making use of parameterized collections with any LINQ operator (other than Contains) fail when that collection happens to be empty:

List<int> ids = [];
_ = await context.Blogs.Join(ids, b => b.Id, ids => ids, (b, ids) => b).ToListAsync();

How found

Multiple customers reported on 10.0.0

Regression

Yes

Testing

Added

Risk

Very low, very small, targeted fix for the precise problematic case. Quirk added just in case.

@roji roji requested a review from cincuranet November 26, 2025 17:24
@roji roji requested a review from a team as a code owner November 26, 2025 17:24
Copy link
Member

@artl93 artl93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple-customer reported regression.

@roji
Copy link
Member Author

roji commented Dec 2, 2025

Servicing approved via email.

@roji roji merged commit 2a4fd00 into dotnet:release/10.0 Dec 2, 2025
7 checks passed
@roji roji deleted the EmptyCollection branch December 2, 2025 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EF Core 10: InvalidOperationException doing primitive list join when list is empty

5 participants