dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.7k stars 1.06k forks source link

dotnet test fails to load app-local ICU on linux #41077

Open bernhard-R opened 5 months ago

bernhard-R commented 5 months ago

Describe the bug

A project I am currently developing needs to be cross-platform and have localization support. Therefore I have opted to install the Microsoft.ICU.ICU4C.Runtime package version 72.1.0.3

Some tests regarding localization do need to use this app-local icu as well and on windows everything is working fine. Our ci pipeline however is running on Debian 11 (amd64) and when trying to run dotnet test -c Release MyProjectTests.csproj it fails with the exception below.

This is logical, as the files in bin/Release/net8.0/runtimes/linux-x64/native/ include the whole version number, so libicudata.so.72.1.0.3 and if i rename the files to *.so.72.1 everything works just fine. The question remains, however, why the testplatform is looking for 72.1 and not the nuget-version number?

To Reproduce

Repo to reproduce

Exceptions (if any)

Testhost process for source(s) 'MyProjectTests.csproj/bin/Debug/net8.0/Seamtec.Control.Cloud.Tests.dll' exited with error: Process terminated. Failed to load app-local ICU: libicudata.so.72.1 at System.Environment.FailFast(System.String) at System.Globalization.GlobalizationMode.LoadLibrary(System.String, Boolean) at System.Globalization.GlobalizationMode.LoadAppLocalIcuCore(System.ReadOnlySpan1<Char>, System.ReadOnlySpan1) at System.Globalization.GlobalizationMode.LoadAppLocalIcu(System.String) at System.Globalization.GlobalizationMode+Settings..cctor() at System.Globalization.CultureData.CreateCultureWithInvariantData() at System.Globalization.CultureData.get_Invariant() at System.Globalization.TextInfo..cctor() at System.Diagnostics.Tracing.EventSource.GetGuid(System.Type) at System.Diagnostics.Tracing.EventSource..ctor(System.Diagnostics.Tracing.EventSourceSettings, System.String[]) at Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing.TestPlatformEventSource..ctor() at Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing.TestPlatformEventSource..cctor() at Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing.TestPlatformEventSource.get_Instance() at Microsoft.VisualStudio.TestPlatform.TestHost.Program.Main(System.String[]) . Please check the diagnostic logs for more information.

Test Run Aborted.

Further technical details

dotnet --info .NET SDK: Version: 8.0.300 Commit: 326f6e68b2 Workload version: 8.0.300-manifests.c1c70047 MSBuild version: 17.10.4+10fbfbf2e

Runtime Environment: OS Name: debian OS Version: 11 OS Platform: Linux RID: linux-x64 Base Path: /usr/share/dotnet/sdk/8.0.300/

.NET workloads installed: There are no installed workloads to display.

Host: Version: 8.0.5 Architecture: x64 Commit: 087e15321b

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

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

Other architectures found: None

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

os information: PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" NAME="Debian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"

PaulCordellier commented 4 days ago

I have the same problem when building to a container with the alpine distro. My project doesn't contain any tests, I don't think it's linked with that. Thanks for reporting!