ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • 10.0.4, 9.1.4, 8.4.4
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Dotnet Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      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.

      Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      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:

      1. 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) and EF-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.
      2. 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 resembles EF-375's signature.
      3. 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.

            Assignee:
            Arthur Vickers
            Reporter:
            Arthur Vickers
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: