Dotnet 3.1 builds fail after icu system package updated to 71.1-1

After updating icu system package to 71.1-1 (International Components for Unicode library) I couldn’t build or run some projects anymore.

Error: Process terminated. 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.

This is not tied only to the build process, applications that require dotnet 3.1 runtime will crash on startup.

Found a workaround without installing any new packages, setting environment variable: CLR_ICU_VERSION_OVERRIDE=71.1

Note that you will need to change this variable every time ICU updates until this issue gets fixed

Edit:

I did some more reasearch, it appears to be a problem with .NET Core 3.1 which has a limitation of max ICU version it can use, which is 70.

End of Support for .NET Core 3.1 is December 13, 2022, in about 6 months so they are not going to support icu 71.

It also appears .NET Core 3.1 runtime is causing the issue and preventing .NET 6.0 builds that reference Microsoft.NET.Sdk.Functions.

The same solution has many projects, some are still on 3.1, that is what’s causing the issue with building .NET 6.0 that reference Microsoft.NET.Sdk.Functions.

I solved it by installing icu70 70.1-1
AUR packages:
https://aur.archlinux.org/packages/icu70

This is bad advise - unlisted.

The proper solution is to fix your dotnet environment and/or project - cripling your system leads to hard-to-solve xyproblems.

1 Like

If you have a better solution, I am open to suggestions.
Downgrading package icu (71.1-1 => 70.1-1) requires the downgrade of many other packages.
Is it really that bad to have icu70 70.1-1 along side icu 71.1-1?

Found a workaround using CLR_ICU_VERSION_OVERRIDE, it’s not ideal but at least you don’t have to downgrade or install the previous version along side the latest one.

I am developing dotnet apps on Manjaro - using Jetbrains Rider - I don’t know of any issues with the icu lib - and I can’t say why you are getting issues.

My system is kept up-to-date continously - often reinstalled (but that is just me - a habit so to speak - as I don’t keep valuable data on my system disk).

I have cloned the AUR script dotnet-core-bin which I manually update and rebuild with new release number when they become available from Microsoft.

My current version is 6.0.6.sdk301

I did some more reasearch, it appears to be a problem with .NET Core 3.1 which has a limitation of max ICU version it can use, which is 70.

End of Support for .NET Core 3.1 is December 13, 2022, in about 6 months so they are not going to support icu 71.

The project I’m working on is mostly .NET 6.0 but it still has some 3.1 code inside it.

For the .NET 6.0 i narrowed down the problem to Microsoft.NET.Sdk.Functions package:

  Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37, 5): Metadata generation failed. Exit code: '134' Error: 'Process terminated. 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.String.ToLowerInvariant()   at System.IO.PathInternal.GetIsCaseSensitive()   at System.IO.PathInternal..cctor()   at System.IO.Enumeration.FileSystemEnumerableFactory.MatchesPattern(System.String, System.ReadOnlySpan`1<Char>, System.IO.EnumerationOptions)   at System.IO.Enumeration.FileSystemEnumerableFactory+<>c__DisplayClass3_0.<UserFiles>b__1(System.IO.Enumeration.FileSystemEntry ByRef)   at System.IO.Enumeration.FileSystemEnumerable`1+DelegateEnumerator[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ShouldIncludeEntry(System.IO.Enumeration.FileSystemEntry ByRef)   at System.IO.Enumeration.FileSystemEnumerator`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()   at System.Linq.Enumerable+WhereEnumerableIterator`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)   at ExtensionsMetadataGenerator.ExtensionsMetadataGenerator.Generate(System.String, System.String, ExtensionsMetadataGenerator.ConsoleLogger)   at ExtensionsMetadataGenerator.Console.Program.Main(System.String[])'

The strange thing about this error is that System.Globalization.GlobalizationMode.GetGlobalizationInvariantMod method doesn’t exist in .NET 6.0 anymore

@linux-aarhus
Since you already have the environmen setup, would you mind running a sample .NET 6.0 project that references Microsoft.NET.Sdk.Functions and seeing if you get the same error?

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net6.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.1" />
    </ItemGroup>
</Project>

dotnet --info

.NET SDK (reflecting any global.json):
 Version:   6.0.301
 Commit:    43f9b18481

Runtime Environment:
 OS Name:     manjaro
 OS Version:  
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.301/

Host (useful for support):
  Version: 6.0.6
  Commit:  7cca709db2

.NET SDKs installed:
  3.1.414 [/usr/share/dotnet/sdk]
  6.0.301 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

I see - I don’t have dotnet 3.1 installed.

If it can be of any help …

10:03:43 fh@tiger test → dotnet new console
The template "Console App" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /a/projects/test/test.csproj...
  Determining projects to restore...
  Restored /a/projects/test/test.csproj (in 98 ms).
Restore succeeded.
10:03:59 fh@tiger test → ls
main.py  obj  Program.cs  test  test.csproj
10:04:06 fh@tiger test → cat test.csproj 
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

</Project>
10:04:13 fh@tiger test → micro test.csproj 
10:06:20 fh@tiger test → cat test.csproj 
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.1" />
    </ItemGroup>
    
</Project>
10:04:44 fh@tiger test → dotnet restore
  Determining projects to restore...
  Restored /a/projects/test/test.csproj (in 4,77 sec).
10:04:57 fh@tiger test → dotnet build
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  test -> /a/projects/test/bin/Debug/net6.0/test.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.62
10:05:07 fh@tiger test → dotnet run
Hello, World!
10:06:12 fh@tiger test → dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.300
 Commit:    8473146e7d

Runtime Environment:
 OS Name:     manjaro
 OS Version:  
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.300/

Host (useful for support):
  Version: 6.0.5
  Commit:  70ae3df4a6

.NET SDKs installed:
  6.0.300 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

1 Like

Thanks for looking into it, it appears .NET Core 3.1 runtime is causing the issue and preventing .NET 6.0 builds that reference Microsoft.NET.Sdk.Functions.

I need .NET Core 3.1 runtime for both my project and also I use some other tools that depend on 3.1, for example Azure Storage Explorer.

I guess I will have to use CLR_ICU_VERSION_OVERRIDE=71.1 workaround to be able tu run anything that depends on .NET Core 3.1 runtime

They should be able to coexist - but you cannot reference different sdks in the same solution.

Just build the 3.1 runtime using dotnet-sdk-lts-bin installed and then build the test project - all with out hickups. (and using only icu 71.1)

Say you have a solution with 2 projects - they have to be using the same sdk - you cannot combine 3.1 and 6.0 in a solution.

Same goes for .NET framework - you cannot reference 2.0 standard in a 4.8 project solution.

So I am fairly certain your issue stems from a dependency conflict in your solution.

1 Like

You are correct, the solution has many projects, some are still on 3.1, that is what’s causing the issue.

I still need tu set CLR_ICU_VERSION_OVERRIDE=71.1 to be able to run 3.1 applications but this solves the mystery of failing builds at least.

Thanks!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.