New System.Linq.Queryable method overloads

Additional public method overloads have been added to System.Linq.Queryable as part of the new features implemented in https://github.com/dotnet/runtime/pull/47231. If your reflection code isn't sufficiently robust when looking up methods, these additions can break your query provider implementations.

Change description

In .NET 6, new overloads were added to the methods listed in the Affected APIs section. Reflection code, such as that shown in the following example, may break as a result of these additions:

typeof(System.Linq.Queryable)
    .GetMethods(BindingFlags.Public | BindingFlags.Static)
    .Where(m => m.Name == "ElementAt")
    .Single();

This reflection code will now throw an InvalidOperationException with a message similar to: Sequence contains more than one element.

Version introduced

.NET 6

Reason for change

The new overloads were added to extend the LINQ Queryable API.

If you're a query-provider library author, ensure that your reflection code is tolerant of method overload additions. For example, use a Type.GetMethod overload that explicitly accepts the method's parameter types.

Affected APIs

New overloads were added for the following Queryable extension methods: