Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-852

System.ArgumentOutOfRangeException when attempting to use custom IComparer with LINQ OrderBy

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.8.3
    • Component/s: None
    • Environment:
      windows 7 x64
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Hi,

      I've been getting an System.ArgumentOutOfRangeException when i attempt to use a custom IComparer with the OrderBy LINQ expression.

      var results = collection.AsQueryable<TestClass>().OrderBy( m => m.Id, new NaturalSortComparer<string>() ).ToList();

      I've attached a program which demonstrates the problem.

      I do have a workaround for this by putting ToList before the OrderBy call but this is not ideal.

      Any suggestions?

            Assignee:
            Unassigned Unassigned
            Reporter:
            jon.swain@autocab.com Jon Swain
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: