Repository navigation
Preserve independent Skip/Take parameters in precompiled queries - #39478
AndriySvyryd with Copilot wants to merge 4 commits into
Conversation
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Agent harness evaluation deferredThis PR affects: |
There was a problem hiding this comment.
🟡 Changes recommended
A critical active finding remains: precompiled path calculation can still deduplicate equal Skip/Take parameters, causing the generated extractor to omit one parameter and mismatch the two-parameter SQL.
1 open issue
What changed in this PR
This pull request fixes incorrect pagination in precompiled queries by preserving independent Skip and Take parameters and recognizing captures from enclosing local functions.
Changes:
- Prevents equal dummy constants from being deduplicated during precompilation.
- Includes Roslyn
Capturedsymbols when discovering query inputs. - Adds SQLite and SQL Server regression coverage and documents the relevant invariants.
This pull request requires changes.
| File | Summary |
|---|---|
test/EFCore.SqlServer.FunctionalTests/Query/PrecompiledQuerySqlServerTest.cs |
Adds SQL Server paging result and parameter assertions. |
test/EFCore.Sqlite.FunctionalTests/Query/PrecompiledQuerySqliteTest.cs |
Adds SQLite paging result and parameter assertions. |
test/EFCore.Relational.Specification.Tests/Query/PrecompiledQueryRelationalTestBase.cs |
Adds shared paging and local-function capture regressions. |
src/EFCore/Query/Internal/ExpressionTreeFuncletizer.cs |
Adjusts parameter deduplication for precompiled queries; the current guard does not cover the path-calculation pass. |
src/EFCore.Design/Query/Internal/CSharpToLinqTranslator.cs |
Includes enclosing local-function captures in query input discovery. |
.agents/skills/query-pipeline/SKILL.md |
Documents precompilation and local-capture requirements. |
Review effort: Lite
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Human validation is needed for generated interceptors, runtime parameter binding across providers, and broader non-lambda/local-function capture shapes beyond the focused relational tests.
No open issues 🎉
1 resolved since last review
Review effort: Lite
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Code coverage overviewLanguages: C# C# / code-coverage
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |

Precompilation evaluates
.Skip(skip).Take(take)with equal dummy values, causing parameter deduplication to alias LIMIT and OFFSET and return incorrect pages. Queries inside local functions can also fail to recognize captured paging variables.Capturedsymbols alongsideDataFlowsInwhen discovering query inputs.