[CSHARP-418] NullReferenceException in LINQ query when querying against inherited field or property Created: 28/Mar/12  Updated: 02/Apr/15  Resolved: 28/Mar/12

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.4
Fix Version/s: 1.4.1

Type: Bug Priority: Major - P3
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CSHARP-432 Linq doesn't work with derived types ... Closed

 Description   

To reproduce:

public class C
{
    public ObjectId Id;
    public int X;
}
 
public class D : C
{
    public int Y;
}

 
var query = from d in collection.AsQueryable<D>()
            where d.X == 1
            select d;
 
foreach (var document in query)
{
    Console.WriteLine(document.ToJson());
}


Generated at Wed Feb 07 21:36:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.