Skip to content
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

NLS System.Globalization.Tests.CompareInfoTests.SortKeyTest with empty string and ZWJ fails on Windows Insiders Preview #42115

Closed
Gnbrkm41 opened this issue Sep 11, 2020 · 4 comments · Fixed by #42212
Labels
area-System.Globalization test-bug Problem in test source code (most likely)
Milestone

Comments

@Gnbrkm41
Copy link
Contributor

This is under the NLS configuration (System.Globalization.Nls.Tests), not sure if it's specific to the version of NLS that ships with the insider builds. Currently I'm running 10 Pro Insiders Build (Dev Channel) Build 20211, ko-KR.

// Zero-weight code points
// In both NLS (Windows) and ICU the code point U+200C ZERO WIDTH NON-JOINER has a zero weight,
// so it's compared as equal to the empty string. This means that we can't special-case GetHashCode("")
// and return a fixed value; we actually need to call the underlying OS or ICU API to calculate the sort key.
yield return new object[] { s_invariantCompare, "", "\u200c", CompareOptions.None, 0 };

Raw XML output:

<test name="System.Globalization.Tests.CompareInfoTests.SortKeyTest(compareInfo: CompareInfo - , string1: \&quot;\&quot;, string2: \&quot;‌\&quot;, options: None, expectedSign: 0)" type="System.Globalization.Tests.CompareInfoTests" method="SortKeyTest" time="0.0054359" result="Fail">
  <failure exception-type="Xunit.Sdk.EqualException">
    <message><![CDATA[Assert.Equal() Failure\r\nExpected: -1\r\nActual:   0]]></message>
    <stack-trace><![CDATA[   at System.Globalization.Tests.CompareInfoTests.SortKeyTest(CompareInfo compareInfo, String string1, String string2, CompareOptions options, Int32 expectedSign) in C:\Users\gotos\source\repos\runtime\src\libraries\System.Globalization\tests\CompareInfo\CompareInfoTests.cs:line 371]]></stack-trace>
  </failure>
</test>

cc @tarekgh

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Globalization untriaged New issue has not been triaged by the area owner labels Sep 11, 2020
@ghost
Copy link

ghost commented Sep 11, 2020

Tagging subscribers to this area: @tarekgh, @safern, @krwq
See info in area-owners.md if you want to be subscribed.

@safern
Copy link
Member

safern commented Sep 11, 2020

It seems like what is being affected and returning a different value now is: Math.Sign(compareInfo.Compare(string1, string2, options))

@tarekgh could it be a bug introduced in Windows where "\u200c is not having a zero weight?

@tarekgh
Copy link
Member

tarekgh commented Sep 11, 2020

@Gnbrkm41 could you please try that with en-US instead of invariant? I am seeing many changes in Windows side for Invariant culture and this can be one of them.

@tarekgh tarekgh added test-bug Problem in test source code (most likely) and removed untriaged New issue has not been triaged by the area owner labels Sep 11, 2020
@tarekgh tarekgh added this to the 6.0.0 milestone Sep 11, 2020
@tarekgh
Copy link
Member

tarekgh commented Sep 12, 2020

I have confirmed this is a regression in Windows (repro on version 20201 too). I am talking to Windows team about it. but it looks we need to workaround it in our tests for now.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Globalization test-bug Problem in test source code (most likely)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants