Skip to content

Cosmos: NullReferenceException when projecting out an owned entity which doesn't own additional entity types #34068

@roji

Description

@roji

@ajcvickers the following throws an NRE from the shaper; it may be triggered by bad processing on my side of the fence, but can you take a look (in any case we probably shouldn't be throwing NRE):

public virtual Task Project_owned_reference_navigation_which_does_not_own_additional(bool async)
    => AssertQuery(
        async,
        ss => ss.Set<OwnedPerson>().OrderBy(o => o.Id).Select(p => p.PersonAddress.Country));

Exception:

System.NullReferenceException
Object reference not set to an instance of an object.
   at lambda_method1037(Closure, QueryContext, JObject)
   at Microsoft.EntityFrameworkCore.Cosmos.Query.Internal.CosmosShapedQueryCompilingExpressionVisitor.QueryingEnumerable`1.AsyncEnumerator.MoveNextAsync() in /Users/roji/projects/efcore/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs:line 269
   at Microsoft.EntityFrameworkCore.Cosmos.Query.Internal.CosmosShapedQueryCompilingExpressionVisitor.QueryingEnumerable`1.AsyncEnumerator.MoveNextAsync() in /Users/roji/projects/efcore/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs:line 292
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken) in /Users/roji/projects/efcore/src/EFCore/Extensions/EntityFrameworkQueryableExtensions.cs:line 2303

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions