From 51fa531355b3f87e3fc071734a91b0ae670ce6c8 Mon Sep 17 00:00:00 2001 From: Jiri Cincura Date: Tue, 18 Nov 2025 13:39:01 +0100 Subject: [PATCH] Fix bucketization for number of parameters between 2070 and 2100. --- .../Query/Internal/SqlServerSqlNullabilityProcessor.cs | 2 +- .../Query/PrimitiveCollectionsQuerySqlServerTest.cs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/EFCore.SqlServer/Query/Internal/SqlServerSqlNullabilityProcessor.cs b/src/EFCore.SqlServer/Query/Internal/SqlServerSqlNullabilityProcessor.cs index 57ec6e8d1a7..a11abe7a071 100644 --- a/src/EFCore.SqlServer/Query/Internal/SqlServerSqlNullabilityProcessor.cs +++ b/src/EFCore.SqlServer/Query/Internal/SqlServerSqlNullabilityProcessor.cs @@ -291,7 +291,7 @@ protected override int CalculateParameterBucketSize(int count, RelationalTypeMap <= 750 => 50, <= 2000 => 100, <= 2070 => 10, // try not to over-pad as we approach that limit - <= MaxParameterCount => 0, // just don't pad between 2070 and 2100, to minimize the crazy + <= MaxParameterCount => 1, // just don't pad between 2070 and 2100, to minimize the crazy _ => 200, }; diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs index a9ac5527ded..6feec54c4d0 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs @@ -2342,6 +2342,16 @@ SELECT COUNT(*) """); } + [ConditionalFact] + public virtual async Task Parameter_collection_of_ints_Contains_int_2071_values() + { + var ints = Enumerable.Repeat(10, 2071).ToArray(); + await AssertQuery(ss => ss.Set().Where(c => ints.Contains(c.Int))); + + // check that 2071 parameter is the last one (and no error happened) + Assert.Contains("@ints2071)", Fixture.TestSqlLoggerFactory.SqlStatements[0], StringComparison.Ordinal); + } + [ConditionalFact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType());