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

Getting No Names in regioninfo class on IOS #15159

Closed
whann0205 opened this issue May 31, 2022 · 7 comments
Closed

Getting No Names in regioninfo class on IOS #15159

whann0205 opened this issue May 31, 2022 · 7 comments

Comments

@whann0205
Copy link

Dont know if this is the correct place to report that question.
If not please be so kind and direct me to the correct forum or
forward my issue to them.

Environment:
Win10
Visual Studio 2022 Preview lastest revision all updates installed
Net Maui lastest revision all updates installed
MacOS Monterrey on MacBook Air M1
Visual Studio 2022 Preview lastest revision all updates installed
Net Maui lastest revision all updates installed
Attached you find a screenshot what happens when i debug the application
on an android target (works ok)
and a screenshot from the same workstation targetting
the macbook´s simulator.
Have updated Xamarin IOS to the latest version
as was suggested by the macbooks´s visual studio
check for updates dialog.

Problem is clear to see i dont get any country names only the 3letter or 2letter code.

Android
IOS

@rolfbjarne
Copy link
Member

This might be related to dotnet/runtime#68321 or dotnet/runtime#69492.

@rolfbjarne
Copy link
Member

Sample code:

var regions = CultureInfo.GetCultures (CultureTypes.SpecificCultures)
	.Select (culture => new RegionInfo (culture.Name))
	.OrderBy (v => v.ThreeLetterISORegionName);
foreach (var r in regions) {
	Console.WriteLine ($"{r.ThreeLetterISORegionName} {r.NativeName} {r.Name} {r.EnglishName} {r.DisplayName}");
}

With iOS (both simulator and device) and Mac Catalyst, I get this:

 001 001 001 001
 150 150 150 150
 419 419 419 419
ABW AW AW AW AW
AIA AI AI AI AI
ALA AX AX AX AX
AND AD AD AD AD
ARE AE AE AE AE
ASM AS AS AS AS
ATG AG AG AG AG
AUS AU AU AU AU
AUT AT AT AT AT
...

on macOS, I get:

 العالم 001 world العالم
 world 001 world world
 Europe 150 Europe Europe
 Mondo 001 world Mondo
 América del Norte 003 North America América del Norte
 Latinoamérica 419 Latin America Latinoamérica
 Mundo 001 world Mundo
 world 001 world world
 world 001 world world
 וועלט 001 world וועלט
ABW Aruba AW Aruba Aruba
AFG افغانستان AF Afghanistan افغانستان
AFG افغانستان AF Afghanistan افغانستان
AFG افغانستان AF Afghanistan افغانستان
AGO Angóla AO Angola Angóla
AGO Angola AO Angola Angola
AIA Anguilla AI Anguilla Anguilla
ALA Åland AX Åland Islands Åland
...

Looks like it could be a difference between Mono and CoreCLR, so I'm moving to dotnet/runtime.

@rolfbjarne
Copy link
Member

This issue was moved to dotnet/runtime#70028

@whann0205
Copy link
Author

Thank you for trying out yourself and posting that to dotnet/runtime group.
Your example is much more clear than my post.
But at the moment i cannot see anyone at dotnet/runtime willing to
go into deep and provide a fix or workaround.

@rolfbjarne
Copy link
Member

@whann0205 it will take some time for them to fix the issue, and I don't think there's workaround to make the RegionInfo class return the full strings, because the full strings just aren't available.

That said, it might be possible to replicate using NSLocale, something like this:

foreach (var country in NSLocale.ISOCountryCodes) {
    Console.WriteLine ($"{country}: {NSLocale.CurrentLocale.GetCountryCodeDisplayName (country)}");
}

@whann0205
Copy link
Author

Thank you. You know, its really annoying that things get broken over and over again.
I try to use that net maui quite a long time.
Everytime i try to put that app into production something else gets broken.
All you get to hear from microsoft is what do you want its in preview...

Besides i cannot use that NSLocaleExample of yours since using Foundation for example does
not work under in a net.maui/blazor page. Dont know what i can do to reference that Class.
Any help is high appreciated and thanks again for your patience!

@rolfbjarne
Copy link
Member

Thank you. You know, its really annoying that things get broken over and over again. I try to use that net maui quite a long time. Everytime i try to put that app into production something else gets broken. All you get to hear from microsoft is what do you want its in preview...

Besides i cannot use that NSLocaleExample of yours since using Foundation for example does not work under in a net.maui/blazor page. Dont know what i can do to reference that Class. Any help is high appreciated and thanks again for your patience!

I'm sorry about the troubles you're running into :/ I also don't know anything about Blazor, but maybe asking here could be an idea: https://github.com/dotnet/maui/discussions?

@ghost ghost locked as resolved and limited conversation to collaborators Jul 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants