I have upgraded dotnet application from Dotnet Core 3.1 to Dotnet 6. After upgrading it I am getting this error:
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')
To fix this I found out that we can try setting the InvariantGlobalization as false
in the csproj under and in the docker we can set ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
. But when I make these change and rerun the application I am getting another error saying:
Process terminated. Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again. Alternatively you can set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. Please see https://aka.ms/dotnet-missing-libicu for more information.
at System.Environment.FailFast(System.String)
And to fix for this suggestions are just vice versa of what I have done to fix the invariant culture(1st issue). Could some one please help me out with this.
My docker file looks like :
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine3.14
LABEL pipelineName="somedummyapplication" \
pipelineKey="DSENJRNF" \
offeringKey="UQWHCLRA"
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
RUN echo 'http://dl-3.alpinelinux.org/alpine/v3.16/main' >> /etc/apk/repositories
RUN apk upgrade && apk add sqlite && apk add krb5
EXPOSE 5000
ENV ASPNETCORE_URLS=http://*:5000
WORKDIR /app
COPY . /app
USER guest
ENTRYPOINT ["dotnet", "abc.somedummyapplication.dll"]
I have already checked and tries these links to fix the issue but as I said if I resolve on another issue comes up: Running .NET 6 project in Docker throws Globalization.CultureNotFoundException and Process terminated. Couldn't find a valid ICU package installed on the system in Asp.Net Core 3 - ubuntu
Alpine-based images do not contain ICU, you need to install it manually.
Note: Alpine 3.16 split the ICU code into two parts.
The icu package has been split into:
- icu-data-en (2.6 MiB) - Stripped down ICU data with only en_US/GB locale and no legacy charset converters.
- icu-data-full (29 MiB) - Full ICU data.
icu-libs only installs icu-data-en. If additional language support is required, icu-data-full needs to be installed manually.
apk add icu-libs icu-data-full
You might also bump into a similar issue with TimeZoneInfo.FindSystemTimeZoneById
, because Alpine-based images do not include tzdb:
apk add tzdata