question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documentation culture does not respect DOTNET_SYSTEM_GLOBALIZATION_INVARIANT

See original GitHub issue

Normally, you want to enforce culture-invariant builds to not risk affecting the build output by the culture of the build agent or (worse) workstation. To resolve this, we run all builds with DOTNET_SYSTEM_GLOBALIZATION_INVARIANT. This crashes some documentation rules because these are newing up a CultureInfo with the hard coded default of “en-US”. As a workaround we can add a config setting the “documentationCulture” to “” (which means the invariant culture).

This is needed because it seems the behaviour of this mode was changed in .NET 6.0, previously setting it meant that all cultures were treated as the invariant culture, as documented here https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-invariant-mode.md#cultures-and-culture-data

With .net 6 it appears it instead throws an exception, so this is possibly to be treated as a .net 6 compatibility issue in this library.

(Note that there are many ways to enable the global invariant mode, so checking for the environment variable is not sufficient)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ArturDorochowiczcommented, Nov 30, 2021

Globalization invariant mode is not necessarily something exotic that can only happen when the user manually overrides the behavior of the runtime. It is for example enabled in official .Net Docker Alpine images: https://github.com/dotnet/dotnet-docker/blob/65ebd21a6e8f574aaaa80bd53a073ed8e9923e4a/src/runtime-deps/3.1/alpine3.14/amd64/Dockerfile#L20

0reactions
JuanZamudioGBMcommented, Jan 6, 2022

Globalization invariant mode is not necessarily something exotic that can only happen when the user manually overrides the behavior of the runtime. It is for example enabled in official .Net Docker Alpine images: https://github.com/dotnet/dotnet-docker/blob/65ebd21a6e8f574aaaa80bd53a073ed8e9923e4a/src/runtime-deps/3.1/alpine3.14/amd64/Dockerfile#L20

Excatly, I ended here because we are upgrading to .Net 6 and changing our CI/CD to arm64 and during the build we saw a lot of this errors

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parameter 'Culture' is an invalid culture identifier
Use the DOTNET_SYSTEM_GLOBALIZATION_INVARIANT environment variable whose values can be: 0 - Access to cultural data; 1 - Run in invariant mode.
Read more >
ASP.NET Core Blazor globalization and localization
This article explains how to render globalized and localized content to users in different cultures and languages.
Read more >
Running .NET 6 project in Docker throws Globalization. ...
I have updated the Dockerfile as below but it did not work. Can any one help here? ARG VERSION=6.0-alpine3.14 #Runtime stage FROM mcr.microsoft....
Read more >
.NET Core, Docker, and Cultures - Solving a culture issue ...
NET Core may not be worth it for you. ... But the docs say the Invariant Culture is s a neutral culture, not...
Read more >
Content Supported by Sourcelens Consulting
Their invariant mode behavior is defined in this document. - Cultures and culture data - String casing - String sorting and searching -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found