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

Set Invariant Globalization for bicep #1938

Open
miqm opened this issue Mar 19, 2021 · 3 comments
Open

Set Invariant Globalization for bicep #1938

miqm opened this issue Mar 19, 2021 · 3 comments
Labels
bug Something isn't working Quality sprint: No

Comments

@miqm
Copy link
Collaborator

miqm commented Mar 19, 2021

Bicep version
v0.3.1

Describe the bug
Wen trying to use bicep and cli on buster-slim image I was receiving error:

Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.
   at System.Environment.FailFast(System.String)
   at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
   at System.Globalization.GlobalizationMode..cctor()
   at System.Globalization.CultureData.CreateCultureWithInvariantData()
   at System.Globalization.CultureData.get_Invariant()
   at System.Globalization.CultureInfo..cctor()
   at System.Globalization.CultureInfo.get_InvariantCulture()
   at System.Text.RegularExpressions.Regex.Init(System.String, System.Text.RegularExpressions.RegexOptions, System.TimeSpan, System.Globalization.CultureInfo)
   at System.Text.RegularExpressions.Regex..ctor(System.String, System.Text.RegularExpressions.RegexOptions, System.TimeSpan, System.Globalization.CultureInfo)
   at System.Text.RegularExpressions.Regex..ctor(System.String, System.Text.RegularExpressions.RegexOptions)
   at Bicep.Core.Resources.ResourceTypeReference..cctor()
   at Bicep.Core.Resources.ResourceTypeReference.TryParse(System.String)
   at Bicep.Core.Resources.ResourceTypeReference.Parse(System.String)
   at Bicep.Core.TypeSystem.Az.AzResourceTypeProvider+<>c.<GetAvailableResourceTypes>b__8_0(System.Collections.Generic.KeyValuePair`2<System.String,Azure.Bicep.Types.Az.TypeLocation>)
   at System.Linq.Enumerable.ToDictionary[[System.Collections.Generic.KeyValuePair`2[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<System.__Canon,System.__Canon>>, System.Func`2<System.Collections.Generic.KeyValuePair`2<System.__Canon,System.__Canon>,System.__Canon>, System.Func`2<System.Collections.Generic.KeyValuePair`2<System.__Canon,System.__Canon>,System.__Canon>, System.Collections.Generic.IEqualityComparer`1<System.__Canon>)
   at Bicep.Core.TypeSystem.Az.AzResourceTypeProvider.GetAvailableResourceTypes(Azure.Bicep.Types.Az.ITypeLoader)
   at Bicep.Core.TypeSystem.Az.AzResourceTypeProvider..ctor(Azure.Bicep.Types.Az.ITypeLoader)
   at Bicep.Core.TypeSystem.Az.AzResourceTypeProvider..ctor()
   at Bicep.Cli.Program.Main(System.String[])

To Reproduce
pull docker buster-slim image, install CLI and bicep, try to deploy image

Additional context
solution to this is to either:

  1. set environment variable on the docker DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
  2. set InvartiantGlobalization to true in project settings: https://docs.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#invariantglobalization
@ghost ghost added the Needs: Triage 🔍 label Mar 19, 2021
@alex-frankel alex-frankel added bug Something isn't working and removed Needs: Triage 🔍 labels Mar 19, 2021
@alex-frankel alex-frankel added this to the Committed Backlog milestone Mar 19, 2021
@majastrz
Copy link
Member

Couldn't you also install the ICU package?

@miqm
Copy link
Collaborator Author

miqm commented Mar 31, 2021

Couldn't you also install the ICU package?

I could, but in bicep we use invariant culture in string comparisons,etc. so we should set it on the top level and not require icu package to be on the system, since it’s not really needed

@majastrz
Copy link
Member

We haven't closed on whether we will support strings localized in multiple languages yet, which potentially means formatting placeholders using culture-specific settings. I'd expect that to break if we set the globalization invariant settings, but I haven't tried it.

If we decide that we don't need to support localization (the requirement would be mainly driven by internal policies) or we can prove that globalization invariant doesn't break that, then I'm fine with making the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Quality sprint: No
Projects
None yet
Development

No branches or pull requests

4 participants