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

Count() throws InvalidOperationException

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.1
    • Affects Version/s: 2.1
    • Component/s: Linq
    • None
    • Environment:
      Window 8 64 bit

      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.

        1. Program.cs
          4 kB
          Ilya

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

              Created:
              Updated:
              Resolved: