Summary
Two sibling reference Include}}s (no {{ThenInclude on either) throw during materialization instead of returning rows.
Found incidentally while probing for EF-372 on 2026-08-05. Pre-existing — reproduces identically at 34a02067 and with the EF-372 fix applied, with zero EF-372 code involved. Deliberately not touched by that slice.
Repro
Model: Root.PrimaryMid and Root.SecondaryMid both reference Mid.
db.Roots.Include(r => r.PrimaryMid).Include(r => r.SecondaryMid)
Result: InvalidOperationException: Document element is missing for required non-nullable property 'Id'.
Notes / open questions
The reporting agent captured the symptom but did not root-cause it. Before doing any work, establish:
- Whether this is specific to two navigations onto the same target entity type, or reproduces for two sibling reference Include}}s onto different types. This matters because two nearby defects are keyed on target entity type:
EF-375({{isSecondOrLaterJoin over an IEntityType-keyed dictionary) andEF-376(navigation-name-only lookup aliases). If it is same-type-only, this is likely a third doorway into one of those, not an independent defect — check that before treating it as its own bug. - Whether the exception arises from a missing $lookup (alias collision, cf.
EF-376) or from an unflattened document reaching the shaper (cf.EF-375). The message names 'Id' on the root, which resemblesEF-375's signature. - Whether it reproduces on all three EF majors.
If step 1 or 2 shows it is the same root cause as EF-375 or EF-376, close this as a duplicate and record the extra doorway on that ticket instead. That pattern has come up repeatedly in this area: EF-366 was reached via both GroupBy and Distinct, and EF-372 via both ThenInclude and chained Join, and in each case the correct fix was one guard at the shared site rather than one per entry point.
Status
Unreleased path: the native cross-collection Include machinery postdates v10.0.2 / v9.1.2 / v8.4.2 (arrived with efb5f256, EF-117); at those release tags any cross-collection Include throws a documented "not supported" exception. No shipped behavior is affected.
No regression test exists yet — one should be added with the fix.