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

CultureInfo.GetCultures(CultureTypes.AllCultures) returns less items on Blazor WASM .NET 5.0 #43449

Closed
ilkayilknur opened this issue Oct 15, 2020 · 8 comments
Labels
Milestone

Comments

@ilkayilknur
Copy link
Contributor

Describe the bug

I just found out that CultureInfo.GetCultures(CultureTypes.AllCultures) method returns only 11 items on Blazor WASM .NET 5 RC2. The same method returns more than 300 items on .NET Core 3.1. Is this a known issue?

To Reproduce

Call CultureInfo.GetCultures(CultureTypes.AllCultures) method on Blazor WASM .NET 5 RC2.

Exceptions (if any)

Further technical details

.NET SDK (reflecting any global.json):
Version: 5.0.100-rc.2.20479.15
Commit: da7dfa8840

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100-rc.2.20479.15\

Host (useful for support):
Version: 5.0.0-rc.2.20475.5
Commit: c5a3f49

.NET SDKs installed:
3.1.402 [C:\Program Files\dotnet\sdk]
3.1.403 [C:\Program Files\dotnet\sdk]
5.0.100-rc.2.20479.15 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.2.20475.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-rc.2.20475.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0-rc.2.20475.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

  • Microsoft Visual Studio Community 2019 Preview Version 16.8.0 Preview 4.0
@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/aspnetcore Oct 15, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Globalization untriaged New issue has not been triaged by the area owner labels Oct 15, 2020
@ghost
Copy link

ghost commented Oct 15, 2020

Tagging subscribers to this area: @tarekgh, @safern, @krwq
See info in area-owners.md if you want to be subscribed.

@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @ilkayilknur.
@lewing can you please answer? Thanks!

@EgorBo
Copy link
Member

EgorBo commented Oct 15, 2020

<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData> should help here.
I wonder if we should load the full ICU version if we can detect that app uses CultureInfo.GetCultures() api?

@lewing
Copy link
Member

lewing commented Oct 15, 2020

@mkArtakMSFT is the BlazorWebAssemblyLoadAllGlobalizationData setting documented anywhere? I found it by reading the code when looking into #43398

@lewing
Copy link
Member

lewing commented Oct 15, 2020

@ilkayilknur It is expected. We've started to document the situation at https://docs.microsoft.com/en-us/dotnet/standard/globalization-localization/globalization-icu#icu-on-webassembly but that doesn't include some of the details about how the data is split up and only a fraction of it (based on the browser language) is loaded by default.
If you intend to load other cultures than the automatic subset you can include:

<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>

in your .csproj. That will load a larger subset of cultures that is intended to mirror the cultures that are supported by browsers. We're working to improve the documentation to cover this.

@tarekgh
Copy link
Member

tarekgh commented Oct 15, 2020

@ilkayilknur I am wondering, what is your scenario that you need to call GetCultures? I am seeing some pattern of the usage of calling this method which is used in wrong way.

@lewing
Copy link
Member

lewing commented Oct 16, 2020

@pranavkm has added some documentation about the option

@marek-safar marek-safar added the arch-wasm WebAssembly architecture label Oct 16, 2020
@lewing lewing removed the untriaged New issue has not been triaged by the area owner label Oct 16, 2020
@SamMonoRT SamMonoRT added this to the 6.0.0 milestone Jun 23, 2021
@SamMonoRT
Copy link
Member

@lewing @pranavkm - is this still an issue for .NET6 or can be closed ?

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

No branches or pull requests

8 participants