[release/6.0] Fix Ordinal Ignore Case string compare #71158
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #71022 to release/6.0
/cc @tarekgh
Customer Impact
Customer reported regression in .NET 6. Sorting with ordinal ignore case results in different behavior compared to .NET 5.0 and .NET Framework. This is limited to the case with non-ASCII strings containing characters support casing. This is difficult for the customer to debug and could surface in many cases like deserialization across frameworks or user app depends on some algorithms like binary trees or sorting.
Example of the broken behavior, when sorting
ѰaandѰB,ѰBwill come beforeѰaAlthough there is only one report, as sorting is a fundamental operation it's likely that other customers are hitting this but aren't aware.
Testing
Have done manual testing to ensure we are getting the right behavior. I have added more tests to ensure I catch this problem if it happens again in the future. The change has passed all regression tests.
Risk
It is low as it is scoped to the failing case only and fixing the behavior. I am not expecting this change to cause any harm or affect anything else.
IMPORTANT: If this change touches code that ships in a NuGet package, please make certain that you have added any necessary package authoring and gotten it explicitly reviewed.