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
While trying to optimize collectiontally by pre-sorting items in #3841, an edge case was hit where a Tuple<T1, T2> may implement IComparable even if it's underlying properties didn't. This could cause an exception at runtime. A workaround was done in the PR (#3881) to catch the exception and fallback to a slower path.
#3976 was subsequently filed around an edge-case of this edge-case, where a tuple which has its first property implement IComparable and it's second doesn't could throw an exception at such a point that it left the array in a corrupt state. The workaround in PR #3978 was to copy the array prior to sorting.
We should consider proactively detecting these cases and falling back to the slow path. This will have a few benefits:
Simpler code
Likely lower memory overhead due to not needing to copy the array internally
Better surfacing of issues in calling code by allowing exceptions in user-defined IComparers to halt the comparison entirely
The text was updated successfully, but these errors were encountered:
While trying to optimize collectiontally by pre-sorting items in #3841, an edge case was hit where a Tuple<T1, T2> may implement IComparable even if it's underlying properties didn't. This could cause an exception at runtime. A workaround was done in the PR (#3881) to catch the exception and fallback to a slower path.
#3976 was subsequently filed around an edge-case of this edge-case, where a tuple which has its first property implement IComparable and it's second doesn't could throw an exception at such a point that it left the array in a corrupt state. The workaround in PR #3978 was to copy the array prior to sorting.
We should consider proactively detecting these cases and falling back to the slow path. This will have a few benefits:
The text was updated successfully, but these errors were encountered: