Document parameterized collection translation as breaking change in EF Core 10 #5163
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.
EF Core 10 changed the default translation of parameterized collections (e.g.,
.Contains()with variable lists) from JSON array parameters to multiple scalar parameters. This causes runtime errors likeSystem.DivideByZeroExceptionwhen collection sizes approach SQL Server's 2,100 parameter limit, but was undocumented in breaking changes.Changes
OPENJSON-WHERE [b].[Id] IN (SELECT [i].[value] FROM OPENJSON(@__ids_0)...)WHERE [b].[Id] IN (@ids1, @ids2, @ids3)UseParameterizedCollectionMode(ParameterTranslationMode.Constant)MultipleParameters(new default),Constant(pre-EF8),SingleJsonParameter(EF8-9)EF.Constant(ids).Contains(b.Id)Categorized as Low-impact, consistent with similar behavioral changes in the release.
Original prompt
This section details on the original issue you should resolve
<issue_title>Why isn’t “LINQ and SQL translation — improved translation for parameterized collections” mentioned in the breaking changes of EF CORE 10?</issue_title>
<issue_description>### Question
Why is the change in default behavior of .Contains() translation not mentioned under Breaking changes for EF Core 10? The same issue was noted in EF Core 8 when this functionality changed.
This change results in a runtime error, System.DivideByZeroException, when a query has a large number of parameters, approaching the 2,100 limit.
I’m sure we’re not the only ones checking the breaking-changes documentation to understand why queries that worked in EF Core 9 are now throwing exceptions.
Your code
Stack traces
Verbose output
EF Core version
10.0.0
Database provider
No response
Target framework
.NET 10
Operating system
No response
IDE
No response</issue_description>
<agent_instructions>Please add a low-impact breaking change note to the 10.0 breaking change, detailing the different default behavior around parameterized collections in EF 10 (the docs for this are in https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-10.0/whatsnew#improved-translation-for-parameteriz...
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.