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

Take(1).SingleOrDefault() throws InvalidOperationException

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 2.1
    • 1.8.3
    • Linq
    • Window 7 64 bit

    Description

      The attached code throws an InvalidOperationException() - Sequence contains more than one element, but there is only one element due to the Take(1) ?

      I can easily work around this issue, but is this a bug or by design?

      var result = collection.AsQueryable().Where( m => m.Name == "Lisa" ).Take( 1 ).SingleOrDefault(); // exception thrown here

      Attachments

        Activity

          People

            Unassigned Unassigned
            paul.bowden Paul Bowden
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: