-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[release/9.0-staging] [iOS] Retrieve device locale in full (specific) format from ObjectiveC APIs #111612
[release/9.0-staging] [iOS] Retrieve device locale in full (specific) format from ObjectiveC APIs #111612
Conversation
/azp run runtime-extra-platforms |
Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @ivanpovazan, @steveisok, @akoeplinger |
Azure Pipelines successfully started running 1 pipeline(s). |
When can we expect an official release of .NET 9 which includes this bugfix? |
FWIW I have seen macOS and iOS machines returning non-sense cultures such as |
prints this on my machine:
That means the first code path is probably safe to change but the later one would now result in |
Are you testing this on macOS or iOS device? I have seen different behavior on these two. In my testing on iOS devices: |
macOS 15.0. Also, |
That's not a valid locale AFAICT. |
I'm not sure what .NET considers as a valid locale in this case. Based on my understanding, .NET allows creating custom cultures thus we can rely on what Objective-C API reports without custom handling/fallbacks from our side as long as the returned culture is not non-sense. In the original PR #111032, I implemented a fallback to neutral culture if the retrieved culture was custom (as classified by .NET), but we agreed on using the retrieved culture directly. I verified locally that for
which is what I would expect. |
After a chat with @matouskozak I agree that the change is fine. The weird Apple cultures like |
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.
lgtm. we will take for consideration in 9.0.x
/ba -g timeouts on coreclr windows x64 debug not related, the extra-platform failures are known and not-related |
/ba-g timeouts on coreclr windows x64 debug not related |
Backport of #111032 to release/9.0-staging
/cc @matouskozak
This PR reverts the previous change to preserve the full (specific = language-region) culture locale format.
Customer Impact
This issue is impacting iOS scenarios which rely on device locale region, such as, displaying local currencies or other regional information. Before this change, only the language was retrieved to set
CultureInfo.CurrentCulture
and the region was omitted.Some of the issues reported by customers:
(Added after merge):
Regression
The regression was introduced in #104071 in .NET 9.
Testing
The previous regression change was intentional. This PR adds a test case for asserting that the default current culture is always in specific format. However, we encountered unexpected behavior on iossimulators running on the CI lab machine thus we disabled the new test case until #111501 gets resolved. We verified locally that the behavior is correct.
Risk
Medium
This change might require customers to change their app logic if they made changes to work around this issue introduced in .NET 9. Note, the behavior is correct in .NET 8.
Additionally, we encountered that for some .NET BCL (e.g.,
SqlString
), the default culture set on device might cause crashes in the libraries code due to #111395. However, these crashes are possible to trigger in .NET 8 iOS apps as well as in apps on other platforms if the user's device locale is not part of the https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/Globalization/IcuLocaleData.cs.IMPORTANT: If this backport is for a servicing release, please verify that:
release/X.0-staging
, notrelease/X.0
.Package authoring no longer needed in .NET 9
IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.