-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Limit PNSE
by using Invariant HashCode
in HybridGlobalization
#96354
Conversation
Tagging subscribers to this area: @dotnet/area-system-globalization Issue DetailsFixes #95921.
|
Azure Pipelines successfully started running 1 pipeline(s). |
Azure Pipelines successfully started running 1 pipeline(s). |
Azure Pipelines successfully started running 1 pipeline(s). |
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs
Outdated
Show resolved
Hide resolved
Azure Pipelines successfully started running 1 pipeline(s). |
...braries/System.Runtime/tests/System.Globalization.Extensions.Tests/GetStringComparerTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/StringComparer.cs
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System.Runtime.Tests/System/StringGetHashCodeTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Text/RuneTests.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.Icu.cs
Show resolved
Hide resolved
Azure Pipelines successfully started running 1 pipeline(s). |
…ted for non-invariant cultures only with `IgnoreCase` or `None` options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for patience with my feedback.
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.WebAssembly.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.WebAssembly.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.WebAssembly.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.Icu.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.WebAssembly.cs
Outdated
Show resolved
Hide resolved
PNSE
by using Invariant SortKey
in HybridGlobalization
PNSE
by using Invariant HashCode
and SortKey
in HybridGlobalization
PNSE
by using Invariant HashCode
and SortKey
in HybridGlobalization
PNSE
by using Invariant HashCode
in HybridGlobalization
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-wasm-libtests |
Azure Pipelines successfully started running 1 pipeline(s). |
AOT lanes won't finish, they are generally broken. Failures are not related. |
…otnet#96354) * Unblock all tests. * SortKey is Invariant now. * Missing SortKey changes + fix HashCode. * Typo * Revert unbocking tests connected with CompareOptions PNSE. * Hashing uses Invariant mode -these tests should be skipped. * Add active issue. * feedback * Feedback * Better documentation. * Add new tests + sanitize string before invariant comparison. * Comment + more cases. * Clean CI. * Missing change for clean CI commit. * `SortKey` not supported for non-invariant cultures, `HashCode` supported for non-invariant cultures only with `IgnoreCase` or `None` options. * Feedback. * Fix build, add docs. * Feedback @matouskozak @pavelsavara * Added tests + fixed algo. * Block failing tests for a follow-up PR. * Add more details to PNSE. * Feedback - correct comment
* Moving the tests, cleaning up. * Removal. * Rename: fix build. * Fix order, apply feedback * Missing changes. * Fixed by #96354 * This test uses SortKey, should not be enabled. * Nit * These methods use `CompareOptions = IgnoreCase, IgnoreKanaType, IgnoreWidth`, should stay blocked.
Fixes paritally #95921.
We used to throw PNSE for all
HashCode
functions. The consequence was throwing PNSE for quite a few APIs, some of them crucial and far-connected with Globalization. With this PR the following APIs do not throw PNSE always (see the update in the doc for details):JS does not expose native, locale-sensitive hashing that we could use, so we decided to utilize Invariant version of functions instead with some limitations. Invariant hashing algorithm differs from ICU hashing with not ignoring empty unicode chars (e.g. zero width joiner), the strings get cleaned from them first.
CompareOptions.None
- use invariant hashing algo.CompareOptions.IgnoreCase
- use JS-native toLower() and then invariant hashing algo.CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols
- keep throwing PNSE, as it was without this PR.It will be documented in the HG doc, so far I did not find an example where the behavior of APIs that threw PNSE so far differs between ICU and HG because of this change.
Out of scope (for follow-up PRs):
HashCode
and performance improvementsSortKey
- investigate similar change