Take(1).SingleOrDefault() throws InvalidOperationException

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Minor - P4
    • 2.1
    • Affects Version/s: 1.8.3
    • Component/s: LINQ
    • Environment:
      Window 7 64 bit
    • None
    • None
    • None
    • None
    • None
    • None

      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

            Assignee:
            Unassigned
            Reporter:
            Paul Bowden
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: