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

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

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • 1.8.3
    • None
    • windows 7 x64

    Description

      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?

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: