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

Breaking change for value returned from CurrentUICulture on Windows #37146

Closed
batzen opened this issue May 29, 2020 · 14 comments
Closed

Breaking change for value returned from CurrentUICulture on Windows #37146

batzen opened this issue May 29, 2020 · 14 comments
Labels
area-System.Globalization untriaged New issue has not been triaged by the area owner

Comments

@batzen
Copy link
Contributor

batzen commented May 29, 2020

Description

In previous versions of .NET (including core) CultureInfo.CurrentUICulture returned the UI language i chose for displaying on Windows.
Starting with .NET 5.0 this is no longer the case and instead my chosen region format is returned.
I think this is a huge breaking change.
I first noticed this when installing the preview SDK version, compiled and received all output in german, which is definitely not what i want.

Configuration

Windows settings:
image
image

Other information

Sample program:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
  </PropertyGroup>

</Project>
using System;

namespace locale_tests
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("System.Globalization.CultureInfo:");
            Console.WriteLine("CurrentCulture      : " + System.Globalization.CultureInfo.CurrentCulture);
            Console.WriteLine("CurrentCulture   (F): " + System.Globalization.CultureInfo.CurrentCulture.GetConsoleFallbackUICulture());
            Console.WriteLine("CurrentUICulture    : " + System.Globalization.CultureInfo.CurrentUICulture);
            Console.WriteLine("CurrentUICulture (F): " + System.Globalization.CultureInfo.CurrentUICulture.GetConsoleFallbackUICulture());
        }
    }
}

Output with net48 is:

PS C:\DEV\Projects\locale_tests> dotnet run -f net48
System.Globalization.CultureInfo:
CurrentCulture      : de-DE      
CurrentCulture   (F): de-DE      
CurrentUICulture    : en-US      
CurrentUICulture (F): en-US   

Output with netcoreapp3.1 is:

PS C:\DEV\Projects\locale_tests> dotnet run -f netcoreapp3.1
System.Globalization.CultureInfo:
CurrentCulture      : de-DE      
CurrentCulture   (F): de-DE      
CurrentUICulture    : en-US      
CurrentUICulture (F): en-US   

Output with net5.0 is (5.0.100-preview.4.20258.7):

PS C:\DEV\Projects\locale_tests> dotnet run -f net5.0       
System.Globalization.CultureInfo:
CurrentCulture      : de-DE      
CurrentCulture   (F): de-DE      
CurrentUICulture    : de-DE      
CurrentUICulture (F): de-DE    
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Globalization untriaged New issue has not been triaged by the area owner labels May 29, 2020
@ghost
Copy link

ghost commented May 29, 2020

Tagging subscribers to this area: @tarekgh, @safern, @krwq
Notify danmosemsft if you want to be subscribed.

@safern
Copy link
Member

safern commented May 29, 2020

Hello @batzen — it seems like you’re hitting: #35638

This bug was present in .NET 5.0 Preview 4 and fixed in Preview5. Could you try it out by installing one of the latest daily builds?

You can get them from here: https://github.com/dotnet/installer/blob/master/README.md#installers-and-binaries

Also, this was a fallout from a change we did to use ICU instead of NLS on Windows, please read more about this here:
https://docs.microsoft.com/en-us/dotnet/standard/globalization-localization/globalization-icu

Also if you can’t install a daily preview you can disable using ICU, described in the docs.

@batzen
Copy link
Contributor Author

batzen commented May 29, 2020

I can confirm that this is fixed with preview 5.
Thanks for pointing me there.

During installation of preview 5 i noticed that the installer uses german as it's display language and that texts are cut of.
Where do i have to report issues regarding the installer?

@safern
Copy link
Member

safern commented May 29, 2020

@jeffschwMSFT @dagood do you guys know who owns the installer?

I wonder if this shows up with the Preview3 installer as well, cause it might also be a fallout from the ICU change on Windows. If you can’t verify that I’ll try it out tomorrow morning pacific time.

@batzen
Copy link
Contributor Author

batzen commented May 29, 2020

I don't thinks it's something new. I also noticed this for older installers for 3.1 etc.
image
image

@safern
Copy link
Member

safern commented May 29, 2020

Thanks for confirming. Then I’ll close this issue since it is fixed in Preview5 and we can make sure to open the installer issue in the right repo once we get a response, if not I’ll figure it out tomorrow.

@safern safern closed this as completed May 29, 2020
@batzen
Copy link
Contributor Author

batzen commented May 29, 2020

I guess it's https://github.com/dotnet/installer
Will report my issue there and also try to create a PR to fix it.
Thanks for your support. 👍

@dagood
Copy link
Member

dagood commented May 29, 2020

The SDK installers are maintained in https://github.com/dotnet/installer, runtime installers in https://github.com/dotnet/runtime, .NET Desktop in https://github.com/dotnet/windowsdesktop, and ASP.NET Core in https://github.com/dotnet/aspnetcore. There actually is no "the installer". (The dotnet/installer repo's name is weird to me.)

Please ping @NikolaMilosavljevic about installer problems reported in dotnet/runtime, as he's the area-Setup owner.

@safern
Copy link
Member

safern commented May 29, 2020

Thanks @dagood that is what confused me as well, we produce too many installers 😀

@batzen
Copy link
Contributor Author

batzen commented May 29, 2020

@safern @daddyman @NikolaMilosavljevic FYI the issue of choosing the wrong locale seems to be a bug in wix itself. My test bundle i just created to verify this also ignores my ui language and uses my regional language. Will create issues at the wix and at the installer repo.

@dagood
Copy link
Member

dagood commented May 29, 2020

@batzen agreed, I came to the came conclusion on https://github.com/dotnet/core/issues/4048#issuecomment-572731975 (although much more tentative). Sorry, didn't catch that was one of the issues you were talking about here. And it looks like you actually already filed an issue for it (which I linked to from that old issue): dotnet/installer#2453. 😄

@batzen
Copy link
Contributor Author

batzen commented May 29, 2020

Uh. Totally forgot about that issue. One year is a long time ;-)
I just tried to compile wix to be able to debug, but everything there is horribly outdated and undocumented... Don't want to mess up my machine so i will just create an issue there.

@batzen
Copy link
Contributor Author

batzen commented May 29, 2020

Ah, it's old behavior that can be overwritten in the .net installer bundle. So wix is already capable to doing the right thing. So there is no need to create an issue at wix, but at the sdk installer bundle project.

@dagood
Copy link
Member

dagood commented May 29, 2020

I'd expect all the .NET bundle installers currently share the same bad behavior, people just haven't run into it yet. (dotnet/installer is a fine place to start though.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Globalization untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

4 participants