You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ImmutableArray<T>.IndexOf throws ArgumentOutOfRangeException when startIndex equals Length and count is 0 #124968
As a result, when startIndex == ImmutableArray.Length and count == 0, Array.IndexOf returns -1, but ImmutableArray<T>.IndexOf throws an ArgumentOutOfRangeException.
When we investigated #70950, I noticed this issue.
Additionally, ImmutableList<T>.IndexOf also had issues such as a missing upper bound guard,
so a PR addressing these together has been submitted at #124967.
Activity
dotnet-policy-service commentedon Feb 27, 2026
Tagging subscribers to this area: @dotnet/area-system-collections
See info in area-owners.md if you want to be subscribed.
Fix dotnet#124968: IndexOf throws when startIndex == Length and count…
Fix dotnet#124968: IndexOf throws when startIndex == Length and count…
Fix ImmutableArray<T>.IndexOf to match Array.IndexOf when startIndex …