Skip to content

Several MemoryExtensions.LastIndexOfAnyExcept overloads incorrectly document "first occurrence" #136282

Open

Description

@ivanvoyager

Description

The XML documentation for several MemoryExtensions.LastIndexOfAnyExcept<T> overloads contains contradictory wording.

The method summaries correctly state that the methods search for the last index. However, their <returns> sections incorrectly say that the returned index is the index of the first occurrence:

The index in the span of the first occurrence of any value other than those in <paramref name="values"/>.

first occurrence should be changed to last occurrence.

Affected APIs

LastIndexOfAnyExcept<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>?

LastIndexOfAnyExcept<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> values, IEqualityComparer<T>? comparer = null)

There may be additional overloads containing the same copied wording.

Reproduction Steps

  1. Open System.MemoryExtensions in the dotnet/runtime repository.
  2. Locate the XML documentation for the following overloads:
LastIndexOfAnyExcept<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>?

LastIndexOfAnyExcept<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> values, IEqualityComparer<T>? comparer = null)
  1. Inspect the <returns> documentation.

Expected behavior

The <returns> documentation should state that the method returns the index of the last occurrence of a value.

Actual behavior

The <returns> documentation incorrectly states that the method returns the index of the first occurrence of a value.

Regression?

No known regression. This appears to be an existing XML documentation error.

Known Workarounds

No response

Configuration

Not configuration-specific. This issue affects the XML documentation in System.MemoryExtensions.

Other information

No response

Activity

  1. dotnet-policy-service commented on Oct 22, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-system-memory
    See info in area-owners.md if you want to be subscribed.

  2. ehsan-raoufi commented on Oct 24, 2026

    @ehsan-raoufi

    Hi! I’d like to work on this issue. Is it available for contribution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions