dotnet / dotnet/dotnet-api-docs

Some Max exception documentation is incorrect

Open
#3,978 9 comments 0 reactions 0 assignees View on GitHub
area-System.Linq Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

- The documentation [here](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.max?view=netframework-4.8#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__) indicates that an ArgumentException will be thrown if no element in source implements IComparable or IComparable. This is not true if source contains only a single element, even if that element does not implement IComparable or IComparable
- The documentation [here](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.max?view=netframework-4.8#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__) does not indicate that an ArgumentException will be thrown if some of the elements of source implement IComparable and some of the elements of source do not implement IComparable or IComparable
- The documentation [here](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.max?view=netframework-4.8#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__) indicates that null can be returned if TSource is a reference type and source is empty, but it does not indicate that an InvalidOperationException will be thrown if TSource is a value type and source is empty
- The documentation [here](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.max?view=netframework-4.8#System_Linq_Enumerable_Max__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__) does not indicate that an ArgumentException can be thrown if none of the projected elements implement IComparable or IComparable, or if only some of them implement IComparable or IComparable
- The documentation [here](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.max?view=netframework-4.8#System_Linq_Enumerable_Max__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__) does not indicate that an InvalidOperationException can be thrown if TResult is a value type and source is empty
- The documentation [here](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.max?view=netframework-4.8#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Int32___) does not indicate that null will be returned if source is empty
- The documentation [here](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.max?view=netframework-4.8#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Double___) does not indicate that null will be returned if source is empty
- The documentation [here](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.max?view=netframework-4.8#System_Linq_Enumerable_Max__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__) does not indicate that null will be returned if source is empty
- The documentation [here](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.max?view=netframework-4.8#System_Linq_Enumerable_Max__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Nullable_System_Int64___) does not indicate that null will be returned if source is empty

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.