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

Bad sample with DOTNET_SYSTEM_GLOBALIZATION_INVARIANT disabled on alpine linux #4126

Closed
BrunoJuchli opened this issue Oct 6, 2022 · 4 comments

Comments

@BrunoJuchli
Copy link

Describe the Bug

# DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \

Is configuring DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false but by testing this does not disable invariant mode.
That is, when I create a CultureInfo with a name like de-ch It has wrong currency symbol and number- and date formats set.

To correctly disable invariant globalization mode I had to change to

DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=0

(0 instead of false).
Note that I did my testing on .net 6 but I expect this hasn't been touched for .net 7?

@mthalman
Copy link
Member

mthalman commented Oct 6, 2022

I think you're running into #3844. The false and 0 values are interchangeable. If it wasn't taking effect, you'd be getting an error like Unhandled exception. System.Globalization.CultureNotFoundException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. when attempting to use a CultureInfo object.

The solution to #3844 is to install the icu-data-full package in addition to icu-libs. We just got a comment yesterday on that issue stating that this sample Dockerfile isn't up-to-date with this requirement. I'm going to be making an update today to fix the samples.

@BrunoJuchli
Copy link
Author

@mthalman
Thank you for your quick response. It looks like you're right that false and 0 are indeed interchangeable.
I looked at the currency symbol do see whether it was running in invariant mode but when testing I changed from de to de-ch culture. de seems to have the invariant symbol, which makes sense since the currency symbol is country specific...

No matter whether I use false or 0 in the ENV variable I still have wrong data for date formats in both the de and the de-ch culture.

We use

  apk update && \
  apk add --no-cache icu tzdata;

in our Dockerfile.

I'll wait and check the updated template to see if it will work as expected then. Otherwise I guess I'll have to file a bug with the dotnet runtime for wrong culture info on (alpine) linux...
Previously there was such a case reported for canadian-french already...

@mthalman
Copy link
Member

mthalman commented Oct 6, 2022

You can see my updates to the samples here: #4127

@BrunoJuchli
Copy link
Author

@mthalman
Thanks a lot! 👍
I can confirm that adding icu-data-full has fixed my issue with wrong date formats (etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants