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

System.MissingMethodException on enumerating IQueryable<Abstract>

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.1
    • Affects Version/s: 1.4.2, 1.5
    • Component/s: None

      Consider this example, where Concrete represents a collection and happens to derive from Abstract, which is an abstract base class.

      IQueryable<Concrete> concretes = collection.AsQueryable();
      IQueryable<Abstract> abstracts = concretes;

      var queryResults = abstracts.Where(...).ToList(); // results in MissingMethodException

      System.MissingMethodException: Constructor on type 'MongoDB.Driver.Linq.Projector2[[[MongoDB.Bson.ObjectId, MongoDB.Bson, Version=1.5.0.26036, Culture=neutral, PublicKeyToken=f686731cfb9cc103]]' not found. at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at MongoDB.Driver.Linq.SelectQuery.Execute() at MongoDB.Driver.Linq.MongoQueryable1.GetEnumerator()

      Note – this used to work perfectly in Fluent mongo.

            Assignee:
            Unassigned Unassigned
            Reporter:
            zaidmasud Zaid Masud
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: