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

Count() throws InvalidOperationException

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 2.1
    • 2.1
    • Linq
    • None
    • Window 8 64 bit

    Description

      The attached code throws an InvalidOperationException() Sequence contains no elements.

      var items = collection.AsQueryable().Where(o => o.Id.Length>100).ToList();
      var count = collection.AsQueryable().Where(o => o.Id.Length>100).Count(); // exception thrown here

      The items value is 0. I want see count value is 0, but have exception.

      Attachments

        Activity

          People

            craig.wilson@mongodb.com Craig Wilson
            IlyaK Ilya
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: