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

[net6] Thread.CurrentThread.CurrentCulture is invariant and does not follow the device culture #14740

Closed
jeromelaban opened this issue Apr 13, 2022 · 7 comments
Labels
bug If an issue is a bug or a pull request a bug fix dotnet An issue or pull request related to .NET (6)
Milestone

Comments

@jeromelaban
Copy link
Contributor

Steps to Reproduce

  1. Create a single view app
  2. Get the values of Thread.CurrentThread.CurrentCulture and Thread.CurrentThread.CurrentUICulture

Expected Behavior

The culture info is set to the current device culture, like it is with legacy mono/xamarin.

Actual Behavior

The culture info is set to the invariant culture.

Environment

RC1

Build Logs

@mandel-macaque
Copy link
Member

@rolfbjarne isn't this an issue with dotnet runtime and not our bindings?

@mandel-macaque mandel-macaque added this to the Future milestone Apr 14, 2022
@mandel-macaque mandel-macaque added the bug If an issue is a bug or a pull request a bug fix label Apr 14, 2022
@spouliot
Copy link
Contributor

There's initialization code inside mono (get_darwin_locale in locale.c) to create a .net culture from Apple's one, where things like FR-de are valid. Since that gets called from the (old/mono) BCL it's possible that the new dotnet BCL does not call it (and defaults to invariant).

A similar situation might be happening for RegionInfo, where the old/mono BCL calls xamarin_get_locale_country_code in xamarin-support.m inside XI's runtime and potentially for TimeZone[Info] too (but I seem to recall that one being fine).

The unit tests that would have found those issues are BCL tests - which are (or were) not run for dotnet profile :(

@rolfbjarne rolfbjarne added the dotnet An issue or pull request related to .NET (6) label Apr 19, 2022
@rolfbjarne rolfbjarne modified the milestones: Future, .NET 6 Apr 19, 2022
@rolfbjarne
Copy link
Member

@jeromelaban which regional settings is your device using?

@akoeplinger
Copy link
Member

This looks similar to dotnet/maui#3962, but we weren't able to reproduce it.

@jeromelaban
Copy link
Contributor Author

@rolfbjarne multiple, I tried on device and on simulator (en-US and fr-CA in current case).

@rolfbjarne
Copy link
Member

I can reproduce in both a macOS and Mac Catalyst app (so this affects both Mono and CoreCLR).

I filed an issue in dotnet/runtime: dotnet/runtime#68321

@rolfbjarne
Copy link
Member

The dotnet/runtime issue has been fixed, and will be shipped in a future .NET 6.0.* release. I don't think we'll need to do anything on our side, so I'm closing this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug If an issue is a bug or a pull request a bug fix dotnet An issue or pull request related to .NET (6)
Projects
None yet
Development

No branches or pull requests

5 participants