Copy-Paste
V3078 Original sorting order will be lost after repetitive call to ‘OrderBy’ method. Use ‘ThenBy’ method to preserve the original sorting. CodeCoverageMethodElement.cs 124
void Init() { .... this.SequencePoints.OrderBy(item => item.Line) .OrderBy(item => item.Column); }
This code will sort the SequencePoints collection only by the Column field, which doesn’t seem to be the desired result. The problem with this code is that the second call to the OrderBy method will sort the collection without taking into account the results of the previous sort. To fix this issue, method ThenBy must be used instead of the second call to OrderBy:
void Init() { .... this.SequencePoints.OrderBy(item => item.Line) .ThenBy(item => item.Column); }
Please click here to see more bugs from this project.