Skip to content

InvalidOperationException for some LINQ SingleOrDefault overloads is not documented  #4469

Closed

Description

@rpetrusha

InvalidOperationException for some LINQ SingleOrDefault overloads is not documented

General

This issue is ported from Issue 630 in the Microsoft/dotnet repo.

Issues with Existing Topics

@dmitrykorolevlighting commented that, "The version of SingleOrDefault() without a predicate throws InvalidOperationException when The input sequence contains more than one element.. The version with a predicate is doing the same, however it is not documented. Due to this, one can incorrectly assume that this method returns a default value not only when a sequence contains zero elements, but also when there were more that one elements that matched the condition."

Specifically, the SingleOrDefault overload that takes a predicate as an argument does not document InvalidOperationException for two types:

Activity

  1. self-assigned this
    on Feb 22, 2018
  2. changed the title [-]InvalidOperationException for some LINQ SingleOrDefault() overloads is not documented [/-] [+]InvalidOperationException for some LINQ SingleOrDefault overloads is not documented [/+] on Feb 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions