-
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
System.Globalization.RegionInfo.CurrentRegion returns blank values on Maui #110704
Comments
Tagging subscribers to this area: @dotnet/area-system-globalization |
Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @ivanpovazan, @steveisok, @akoeplinger |
@matouskozak could you please have a look at this one too? Thanks! This is most likely related to the issue that the |
I think you're right. @mmiller-d8 Thank you for reporting the issue, a temporary workaround for you could be to set the |
@matouskozak I'm seeing that it also doesn't work to create a CultureInfo object with the name. It creates it, but it doesn't have the correct information - so trying to use that to write a formatted currency string doesn't work. You get the same weird currency symbol no matter what. |
Could you please share what code did you use and what results are you expecting? Thank you. |
Well, I know there are some things I'm fundamentally misunderstanding. What I want to do is request a price from the server in the user's currency. Then I need to display that currency based on the culture settings. The trouble is that neither of these work:
or
Neither of these produce the correct currency symbol ($123.45). Both of them use a currency symbol that I don't recognize. Interestingly, there is nothing that I can see in CurrentCulture that makes it look invalid. However, this does work:
This one uses the correct symbol. And, of course, this still does not work:
So... As I was messing with this, I did find an imperfect workaround. I think.
What I'm really not sure about is if RegionInfo.CurrentRegion returns the physical location of the device or if it is based on system settings. I assume it's based on system settings, but I don't actually know that. |
It should be based on the system settings. I think that for iOS, you could use Note, the issue should be fixed in next servicing .NET 9.0.3 release (should get release in ~ March). |
Thank you for the update and the tip, @matouskozak |
I am observing a variation to this issue where this bug appears on .NET MAUI 9 (tested 9.0.40) and Mac Catalyst and iOS implementations of CultureInfo whereby the country/region is dropped from CultureInfo.InstalledUICulture, CultureInfo.CurrentUICulture and CultureInfo.CurrentCulture
The impact is already noticeable in severe localization regression:
I totally agree with@mmiller-d8 assessment:
Link to public reproduction project repository |
Thank you @stephenquan for the feedback. As mentioned in #110704 (comment), the fix will be part of the next 9.0.3 .NET runtime servicing release. In the meantime, if you need, you can use the workaround with |
Description
System.Globalization.RegionInfo.CurrentRegion returns a default RegionInfo object. This worked before upgrading to .net 9.
Currently, I've only tested this on iOS.
Another thing that is broken with .net 9 is my ability to compile for Android at all. There is a discrepancy with the SDK version, but that's a different issue.
This is kind of a big deal. I would assume it breaks globalization? It does certainly break the ability to show the correct currency symbol in my app. It also makes it impossible for me to get the correct pricing to display to the user.
Steps to Reproduce
Link to public reproduction project repository
No response
Version with bug
9.0.0 GA
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.100 SR10
Affected platforms
I was not able test on other platforms
Affected platform versions
iOS 17.2 is the only one I've tested it on.
Did you find any workaround?
I did not.
Relevant log output
The text was updated successfully, but these errors were encountered: