-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String.CompareTo Behaviour different between WIN10 & Linux #36177
Comments
Different culture between the two? Try using |
This is by design for the .NET as we depend on the underlying OS for globalization support. so it is expected to see some behavior differences when running on Windows against Linux. @benaadams suggestion to use ordinal comparison should help if this will be ok in your scenario. In .NET Core 5.0, we have started to use the ICU library on Windows too. That means the behavior on Windows and Linux should be the same or very close. You may give it a try. |
Cheers. Tweaking the culture indeed yielded the required behaviour. |
Console.WriteLine("[".CompareTo("_"));
On Windows => -1
On Linux => 1
Linux :
.NET Core SDK (reflecting any global.json):
Version: 3.1.201
Commit: b1768b4ae7
Runtime Environment:
OS Name: debian
OS Version: 10
OS Platform: Linux
RID: debian.10-x64
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
Windows :
.NET Core SDK (reflecting any global.json):
Version: 3.1.201
Commit: b1768b4ae7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
The text was updated successfully, but these errors were encountered: