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.

Azure storage is requiring Cultures to be installed instead of using Invariant culture support breaking Dockerized apps etc.

See original GitHub issue

Which service(blob, file, queue, table) does this issue concern?

Blob

Which version of the SDK was used?

Microsoft.Azure.Storage.Blob, Version=10.0.1.0 (which says that it’s Culture-neutral which it isn’t)

Which platform are you using? (ex: .NET Core 2.1)

.NET Core 6 RC 2

What problem was encountered?

The library requires culture info which bloats docker. It shouldn’t need to use anything to do with culture ever.

How can we reproduce the problem in the simplest way?

Simply try to use the option to force .NET to use invariant culture in the csproj.

<RuntimeHostConfigurationOption Include="System.Globalization.Invariant" Value="true" />

Then use the standard calls and you’ll get this error on any call (because it’s in authentication code)

An unhandled exception has occurred while executing the request. Microsoft.Azure.Storage.StorageException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter ‘name’) en-US is an invalid culture identifier. —> System.Globalization.CultureNotFoundException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter ‘name’) en-US is an invalid culture identifier. at System.Globalization.CultureInfo…ctor(String name, Boolean useUserOverride) at Microsoft.Azure.Storage.Core.Util.AuthenticationUtility.AppendCanonicalizedCustomHeaders(CanonicalizedString canonicalizedString, HttpRequestMessage request) at Microsoft.Azure.Storage.Core.Auth.SharedKeyCanonicalizer.CanonicalizeHttpRequest(HttpRequestMessage request, String accountName) at Microsoft.Azure.Storage.Auth.Protocol.StorageAuthenticationHttpHandler.GetSharedKeyAuthenticationTask(StorageRequestMessage request, CancellationToken cancellationToken) at Microsoft.Azure.Storage.Auth.Protocol.StorageAuthenticationHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Microsoft.Azure.Storage.Core.Executor.Executor.ExecuteAsync[T](RESTCommand1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token) --- End of inner exception stack trace --- at Microsoft.Azure.Storage.Core.Executor.Executor.ExecuteAsync[T](RESTCommand1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token

Have you found a mitigation/solution?

Not other than tripling the size of my docker image.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:5

github_iconTop GitHub Comments

1reaction
n8allancommented, Mar 4, 2022

Correct @JohnGalt1717, it’s a work-around not a solution. I highlighted what I think is the culprit above, and someone should fix it so that the library works with invariant culture, but it would need to be a member of the team that understands why “cannonized headers” are important, and whether or not en-US is actually needed for that purpose.

1reaction
n8allancommented, Mar 3, 2022

For posterity, my work-around was to install the ICU library… sudo apt install libicu-dev … and either remove this from the csproj file (if it’s there):

<ItemGroup>
	<RuntimeHostConfigurationOption Include="System.Globalization.Invariant" Value="true" />
</ItemGroup>

or add this:

<PropertyGroup>
	<InvariantGlobalization>false</InvariantGlobalization>
</PropertyGroup>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Running .NET 6 project in Docker throws Globalization. ...
Full stack trace is here. Microsoft.Azure.Storage.StorageException: Only the invariant culture is supported in globalization-invariant mode. See ...
Read more >
.NET Core, Docker, and Cultures - Solving a culture issue ...
In this post I describe how I fixed an issue with Cultures that arose when porting an ASP.NET Windows app to ASP.NET Core...
Read more >
Working with containers and Azure Functions
This article demonstrates the support that Azure Functions provides for working with function apps running in Linux containers.
Read more >
Deploying Docker containers on Azure
Install the Docker Compose CLI on Linux​​ The Docker Compose CLI adds support for running and managing containers on Azure Container Instances (ACI)....
Read more >
10 things to avoid in docker containers | Red Hat Developer
First: Containers are immutable - The OS, library versions, configurations, folders, and application are all wrapped inside the container. You ...
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