Skip to content

Fix query precompiler rejecting ThenInclude sources - #39297

Open
AndriySvyryd with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-theninclude-query-issue
Open

AndriySvyryd with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-theninclude-query-issue

Conversation

Copilot AI commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Query precompilation throws Non-IQueryable first parameter for ThenInclude because interceptor generation expects exactly one source type argument. IIncludableQueryable<TEntity, TPreviousProperty> has two.

  • Interceptor generation: Extract the first source type argument without requiring it to be the only argument.
  • Regression coverage: Exercise reference and collection overloads, single and chained ThenInclude calls, and sync/async execution through generated-code compilation and execution. Add SQL Server baselines.

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Non-IQueryable first parameter for ThenInclude Fix query precompiler rejecting ThenInclude sources Oct 16, 2026
Copilot AI requested a review from AndriySvyryd October 16, 2026 22:26
Comment thread .agents/skills/query-pipeline/SKILL.md Resolved
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved review issues were identified.

No open issues 🎉

What changed in this PR

Fixes precompiled query generation for ThenInclude chains with multi-generic source types.

Changes:

  • Supports multi-argument IIncludableQueryable sources.
  • Adds comprehensive sync/async and chained ThenInclude regression tests.
  • Adds SQL Server baselines and guidance.
File Description
test/​EFCore.SqlServer.FunctionalTests/​Query/​AdHocPrecompiledQuerySqlServerTest.cs Adds SQL Server baselines.
test/​EFCore.Relational.Specification.Tests/​Query/​AdHocPrecompiledQueryRelationalTestBase.cs Adds ThenInclude regression coverage.
src/​EFCore.Design/​Query/​Internal/​PrecompiledQueryCodeGenerator.cs Supports multi-generic ThenInclude sources.
.agents/​skills/​query-pipeline/​SKILL.md Documents precompiled include-chain guidance.

Review effort: Lite

@AndriySvyryd
AndriySvyryd marked this pull request as ready for review October 17, 2026 04:32
@AndriySvyryd
AndriySvyryd requested a review from a team as a code owner October 17, 2026 04:32
@AndriySvyryd
AndriySvyryd requested review from cincuranet and a lite review from Copilot October 17, 2026 04:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved blocking issues were identified.

No open issues 🎉

Review effort: Lite

@github-code-quality

github-code-quality Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: C#

C# / code-coverage

main 8ece311 copilot/fix-thenincl... b426c7a +/-
76% 76% 0%
View coverage of the 10 most impacted files.
File main 8ece311 copilot/fix-thenincl... b426c7a +/-
src/EFCore.Sqli...ryRepository.cs 97% 91% -6%
src/Shared/NonC...yInitializer.cs 12% 11% -1%
src/EFCore.Abst...erExtensions.cs 100% 100% 0%
src/EFCore.Anal...icSuppressor.cs 96% 96% 0%
src/EFCore.Cosm...nsExtensions.cs 82% 82% 0%
src/EFCore.Desi...onExtensions.cs 100% 100% 0%
src/EFCore.Desi...viderFactory.cs 95% 95% 0%
src/EFCore.Desi...CSharpHelper.cs 96% 96% 0%
src/EFCore.Desi...seOperations.cs 98% 98% 0%
src/EFCore.Desi...ionGenerator.cs 100% 100% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 31, 2026 01:04 UTC

Copilot AI lite review requested due to automatic review settings October 31, 2026 00:33
@AndriySvyryd
AndriySvyryd enabled auto-merge (squash) October 31, 2026 00:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain, and the change includes targeted ThenInclude handling plus regression coverage for the affected scenarios.

No open issues 🎉

Review effort: Lite

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.

Query precompiler throws Non-IQueryable first parameter for ThenInclude

3 participants