Skip to content

ArgumentOutOfRangeException in ObservableList when calling RemoveRange method #109

@BladeanMericle

Description

@BladeanMericle

.NET Framework Version: 4.7.2
ObservableCollections Version: 3.3.4

I am trying this code, but it raised an ArgumentOutOfRangeException in the RemoveRange method.
Incidentally, no exceptions occurred in .NET 8.

Code

ObservableList<int> list = new ObservableList<int> { 1, 2, 3, 4, 5 };
list.RemoveRange(1, 3);
list.ForEach(x => Console.Write(x + ",")); // Expected : 1,5,

Stack trace

System.ArgumentOutOfRangeException
  HResult=0x80131502
  Message=指定された引数は、有効な値の範囲内にありません。
パラメーター名:start
  Source=ObservableCollections
  スタック トレース:
   at ObservableCollections.ObservableList`1.RemoveRange(Int32 index, Int32 count)
   at SandBox4._7._2.Program.Main(String[] args) in D:\Repositories\SandBox\SandBox4.7.2\Program.cs:line 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions