-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
[aot][browser] Stop throwing in CultureInfo getter #95910
Conversation
Tagging subscribers to this area: @dotnet/area-system-globalization Issue DetailsFixes #94225. This workaround assures HybridGlobalization works with AOT.
|
/azp run runtime-wasm-libtests |
Azure Pipelines successfully started running 1 pipeline(s). |
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs
Outdated
Show resolved
Hide resolved
/azp run runtime-wasm-libtests |
Azure Pipelines successfully started running 1 pipeline(s). |
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs
Outdated
Show resolved
Hide resolved
/azp run runtime-wasm-libtests |
Azure Pipelines successfully started running 1 pipeline(s). |
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs
Outdated
Show resolved
Hide resolved
/azp run runtime-wasm-libtests |
Azure Pipelines successfully started running 1 pipeline(s). |
Failures are same as original issue, but for Invariant. |
I see
It's non-Hybrid AOT of Which is some |
After reverting my changes, running Invariant tests to reproduce the failures
with SystmKeys Confirmed, it is the same assert being hit. However, the fix for Hybrid does not work for Invariant, |
/azp run runtime-wasm-libtests |
Azure Pipelines successfully started running 1 pipeline(s). |
Fixes #94225. This workaround ensures
HybridGlobalization
works with AOT.The logic in CultureInfo is following:
because of this flow,
Debug.Assert(s_InvariantCultureInfo != null);
is hit, causing a failure:Encountered infinite recursion while looking up resource 'Arg_NullReferenceException' in System.Private.CoreLib
whenUseSystemResourceKeys=false
ORError: TypeInitialization_Type, Microsoft.DotNet.XHarness.TestRunners.Common.ApplicationOptions (The type initializer for 'Microsoft.DotNet.XHarness.TestRunners.Common.ApplicationOptions' threw an exception.
whenUseSystemResourceKeys=true
.We could change the behavior of AOT on mono side but it would affect the performance negatively.
Original workaround approach:
We make sure that we don't create the method dependency loop and move the initialization of
s_InvariantCultureInfo
to the getter.problems with this approach:
GlobalizationMode.Invarant is still locked in a cctor loop, so it fixes only part of the problem, connected with GlobalizationMode.Hybrid.
Changes in this PR:
CultureInfo
inGlobalizationMode.Settings
. Ordinal comparison of strings is under the hood a loop over these strings with==
operator on corresponding characters. I do not see a reason whystr.Equals("1", StringComparison.Ordinal)
would be better thanstr == "1"
. If it exists, please ask for changes.