Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-418

NullReferenceException in LINQ query when querying against inherited field or property

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.1
    • Affects Version/s: 1.4
    • Component/s: None
    • None

      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());
      }
      

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: