`StringComparer.CurrentCultureIgnoreCase.GetHashCode` - broken behavior with `try.dot.net`(online)
Describe the bug
@tfenise is seeing broken behavior of StringComparer.CurrentCultureIgnoreCase.GetHashCode with try.dot.net, which is not reproducible with net6.0, or net7.0. I think this might be due to try.dot.net using a very old version of blazor.
From the original issue:
Reproduction Steps
Go to https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2.-ctor?view=net-6.0#code-try-7. Run the code example in the online .NET Editor.
Expected behavior
It should produce the output as indicated at the end of the code example.
In particular,
Dictionary<string, string> openWith =
new Dictionary<string, string>(
StringComparer.CurrentCultureIgnoreCase);
openWith.Add("bmp", "paint.exe");
openWith.Add("BMP", "paint.exe");
should fail.
Actual behavior
The actual output is different from what is indicated at the end of the code example. In particular, openWith.Add("BMP", "paint.exe"); succeeds. Further investigation reveals that StringComparer.CurrentCultureIgnoreCase.Equals("bmp", "BMP") is indeed true, but StringComparer.CurrentCultureIgnoreCase.GetHashCode("bmp") and StringComparer.CurrentCultureIgnoreCase.GetHashCode("BMP") happen to be different.
Did this error occur while using dotnet try or online?
- [ ]
dotnet-try - [x] online
What kind of error was it?
- [ ] User Interface (UI): For example the output never displayed
- [ ] Service Error: For example "The service is temporarily unavailable. We are working on it"
- [x] Other:
Screenshots
If applicable, add screenshots to help explain your problem.
Please complete the following:
- OS
- [x] Windows 10
- [ ] macOS
- [ ] Linux (Please specify distro)
- [ ] iOS
- [ ] Android
- Browser
- [ ] Chrome
- [x] Edge
- [ ] Safari
cc @tarekgh