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.73k stars 1.07k forks source link

'dotnet tool install' command fails for platform linux/arm64 - Unhandled exception: System.NullReferenceException: Object reference not set to an instance of an object. #44051

Open gray380 opened 1 month ago

gray380 commented 1 month ago

Hello,

First of all, I want to note that about 5 weeks ago, the problem was not observed. But something has changed.

Dockerfile (part of):

RUN dotnet --info \
 && dotnet tool install --global dotnet-sonarscanner \
 && dotnet tool install --global coverlet.console --version 6.0.0 \
 && dotnet tool install --global dotnet-gcdump --version 8.0.452401 \
 && dotnet tool install --global trx2junit \
 && ln -s ~/.dotnet/tools/trx2junit /usr/local/bin/trx2junit

Gitlab pipeline (part of):

image: docker:25.0.5
services:
    - name: docker-dind:25.0.5
      alias: docker

Gitlab runner host Host:

PLATFORM_ID="platform:al2023"
PRETTY_NAME="Amazon Linux 2023.5.20240819"
CPU Model name:             AMD EPYC 7571

Command to build image:

docker buildx build --build_arg ... --platform linux/amd64,linux/arm64 -t ... --push --progress plain -f ... .
platform linux/amd64 succeed: ```text #13 [linux/amd64 4/4] RUN dotnet --info && dotnet tool install --global dotnet-sonarscanner && dotnet tool install --global coverlet.console --version 6.0.0 && dotnet tool install --global dotnet-gcdump --version 8.0.452401 && dotnet tool install --global trx2junit && ln -s ~/.dotnet/tools/trx2junit /usr/local/bin/trx2junit #13 0.568 .NET SDK: #13 0.568 Version: 8.0.403 #13 0.568 Commit: c64aa40a71 #13 0.688 Workload version: 8.0.400-manifests.18f19b92 #13 0.690 MSBuild version: 17.11.9+a69bbaaf5 #13 0.690 #13 0.690 Runtime Environment: #13 0.692 OS Name: debian #13 0.692 OS Version: 12 #13 0.697 OS Platform: Linux #13 0.710 RID: linux-x64 #13 0.710 Base Path: /usr/share/dotnet/sdk/8.0.403/ #13 0.710 #13 0.710 .NET workloads installed: #13 0.715 Configured to use loose manifests when installing new manifests. #13 0.715 There are no installed workloads to display. #13 0.716 #13 0.716 Host: #13 0.716 Version: 8.0.10 #13 0.716 Architecture: x64 #13 0.716 Commit: 81cabf2857 #13 0.716 #13 0.716 .NET SDKs installed: #13 0.716 8.0.403 [/usr/share/dotnet/sdk] #13 0.716 #13 0.716 .NET runtimes installed: #13 0.716 Microsoft.AspNetCore.App 8.0.10 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] #13 0.716 Microsoft.NETCore.App 8.0.10 [/usr/share/dotnet/shared/Microsoft.NETCore.App] #13 0.716 #13 0.716 Other architectures found: #13 0.716 None #13 0.716 #13 0.716 Environment variables: #13 0.716 Not set #13 0.716 #13 0.716 global.json file: #13 0.716 Not found #13 0.716 #13 0.716 Learn more: #13 0.716 https://aka.ms/dotnet/info #13 0.716 #13 0.716 Download .NET: #13 0.716 https://aka.ms/dotnet/download #13 3.725 You can invoke the tool using the following command: dotnet-sonarscanner #13 3.725 Tool 'dotnet-sonarscanner' (version '9.0.0') was successfully installed. #13 5.652 You can invoke the tool using the following command: coverlet #13 5.652 Tool 'coverlet.console' (version '6.0.0') was successfully installed. ```
platform linux/arm64 failed: ```text #14 [linux/arm64 4/4] RUN dotnet --info && dotnet tool install --global dotnet-sonarscanner && dotnet tool install --global coverlet.console --version 6.0.0 && dotnet tool install --global dotnet-gcdump --version 8.0.452401 && dotnet tool install --global trx2junit && ln -s ~/.dotnet/tools/trx2junit /usr/local/bin/trx2junit #14 6.996 .NET SDK: #14 6.999 Version: 8.0.403 #14 6.999 Commit: c64aa40a71 #14 8.578 Workload version: 8.0.400-manifests.18f19b92 #14 8.590 MSBuild version: 17.11.9+a69bbaaf5 #14 8.591 #14 8.592 Runtime Environment: #14 8.622 OS Name: debian #14 8.622 OS Version: 12 #14 8.681 OS Platform: Linux #14 8.848 RID: linux-arm64 #14 8.850 Base Path: /usr/share/dotnet/sdk/8.0.403/ #14 8.850 #14 8.851 .NET workloads installed: #14 8.906 Configured to use loose manifests when installing new manifests. #14 8.906 There are no installed workloads to display. #14 8.954 #14 8.954 Host: #14 8.954 Version: 8.0.10 #14 8.954 Architecture: arm64 #14 8.954 Commit: 81cabf2857 #14 8.954 #14 8.954 .NET SDKs installed: #14 8.954 8.0.403 [/usr/share/dotnet/sdk] #14 8.954 #14 8.954 .NET runtimes installed: #14 8.954 Microsoft.AspNetCore.App 8.0.10 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] #14 8.954 Microsoft.NETCore.App 8.0.10 [/usr/share/dotnet/shared/Microsoft.NETCore.App] #14 8.954 #14 8.954 Other architectures found: #14 8.954 None #14 8.954 #14 8.954 Environment variables: #14 8.954 Not set #14 8.954 #14 8.954 global.json file: #14 8.954 Not found #14 8.954 #14 8.954 Learn more: #14 8.954 https://aka.ms/dotnet/info #14 8.954 #14 8.954 Download .NET: #14 8.954 https://aka.ms/dotnet/download #14 38.21 Unhandled exception: System.NullReferenceException: Object reference not set to an instance of an object. #14 38.45 at CreateNuGet.Protocol.Model.RegistrationIndex() #14 38.45 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator) #14 38.45 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) #14 38.45 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) #14 38.45 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) #14 38.45 at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) #14 38.45 at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader) #14 38.45 at NuGet.Protocol.PackageMetadataResourceV3.DeserializeStreamDataAsync[T](Stream stream, CancellationToken token) #14 38.45 at NuGet.Protocol.PackageMetadataResourceV3.<>c__DisplayClass9_0.<b__0>d.MoveNext() #14 38.45 --- End of stack trace from previous location --- #14 38.45 at NuGet.Protocol.HttpSource.<>c__DisplayClass15_0`1.<b__0>d.MoveNext() #14 38.45 --- End of stack trace from previous location --- #14 38.45 at NuGet.Common.ConcurrencyUtilities.ExecuteWithFileLockedAsync[T](String filePath, Func`2 action, CancellationToken token) #14 38.45 at NuGet.Common.ConcurrencyUtilities.ExecuteWithFileLockedAsync[T](String filePath, Func`2 action, CancellationToken token) #14 38.45 at NuGet.Protocol.HttpSource.GetAsync[T](HttpSourceCachedRequest request, Func`2 processAsync, ILogger log, CancellationToken token) #14 38.45 at NuGet.Protocol.PackageMetadataResourceV3.LoadRegistrationIndexAsync(HttpSource httpSource, Uri registrationUri, String packageId, SourceCacheContext cacheContext, Func`2 processAsync, ILogger log, CancellationToken token) #14 38.45 at NuGet.Protocol.PackageMetadataResourceV3.GetMetadataAsync(String packageId, Boolean includePrerelease, Boolean includeUnlisted, VersionRange range, SourceCacheContext sourceCacheContext, ILogger log, CancellationToken token) #14 38.45 at NuGet.Protocol.PackageMetadataResourceV3.GetMetadataAsync(String packageId, Boolean includePrerelease, Boolean includeUnlisted, SourceCacheContext sourceCacheContext, ILogger log, CancellationToken token) #14 38.45 at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetPackageMetadataAsync(PackageSource source, String packageIdentifier, Boolean includePrerelease, Boolean includeUnlisted, CancellationToken cancellationToken) #14 38.45 at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetMatchingVersionInternalAsync(String packageIdentifier, IEnumerable`1 packageSources, VersionRange versionRange, CancellationToken cancellationToken) #14 38.45 at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetBestPackageVersionAsync(PackageId packageId, VersionRange versionRange, PackageSourceLocation packageSourceLocation) #14 38.45 at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass8_0.b__0() #14 38.45 at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback) #14 38.45 at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.<>c__DisplayClass23_0.b__1() #14 38.45 at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.RunWithHandlingInstallError(Action installAction, PackageId packageId) #14 38.45 at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.ExecuteInstallCommand(PackageId packageId) #14 38.45 at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute() #14 38.45 at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult) #14 38.45 at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient) #14 ERROR: process "/bin/sh -c dotnet --info && dotnet tool install --global dotnet-sonarscanner && dotnet tool install --global coverlet.console --version 6.0.0 && dotnet tool install --global dotnet-gcdump --version 8.0.452401 && dotnet tool install --global trx2junit && ln -s ~/.dotnet/tools/trx2junit /usr/local/bin/trx2junit" did not complete successfully: exit code: 1 ------ > [linux/arm64 4/4] RUN dotnet --info && dotnet tool install --global dotnet-sonarscanner && dotnet tool install --global coverlet.console --version 6.0.0 && dotnet tool install --global dotnet-gcdump --version 8.0.452401 && dotnet tool install --global trx2junit && ln -s ~/.dotnet/tools/trx2junit /usr/local/bin/trx2junit: 38.45 at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetMatchingVersionInternalAsync(String packageIdentifier, IEnumerable`1 packageSources, VersionRange versionRange, CancellationToken cancellationToken) 38.45 at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetBestPackageVersionAsync(PackageId packageId, VersionRange versionRange, PackageSourceLocation packageSourceLocation) 38.45 at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass8_0.b__0() 38.45 at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback) 38.45 at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.<>c__DisplayClass23_0.b__1() 38.45 at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.RunWithHandlingInstallError(Action installAction, PackageId packageId) 38.45 at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.ExecuteInstallCommand(PackageId packageId) 38.45 at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute() 38.45 at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult) 38.45 at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient) ```

Could you help to solve this issue?

Regards, Serhiy.

martincostello commented 1 month ago

Looks similar to #43651.

gray380 commented 1 month ago

I've added --verbosity diagnostic to the first dotnet tool install command:

amd64 success ```text #13 3.369 [NuGet Manager] [Info] GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-sonarscanner/index.json #13 3.488 [NuGet Manager] [Info] OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-sonarscanner/index.json 118ms #13 3.666 [NuGet Manager] [Info] GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-sonarscanner/index.json #13 3.790 [NuGet Manager] [Info] OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-sonarscanner/index.json 125ms #13 3.889 [NuGet Manager] [Info] GET https://api.nuget.org/v3-flatcontainer/dotnet-sonarscanner/index.json #13 4.010 [NuGet Manager] [Info] OK https://api.nuget.org/v3-flatcontainer/dotnet-sonarscanner/index.json 120ms #13 4.045 [NuGet Manager] [Info] GET https://api.nuget.org/v3-flatcontainer/dotnet-sonarscanner/9.0.0/dotnet-sonarscanner.9.0.0.nupkg #13 4.048 [NuGet Manager] [Info] OK https://api.nuget.org/v3-flatcontainer/dotnet-sonarscanner/9.0.0/dotnet-sonarscanner.9.0.0.nupkg 4ms #13 4.089 Skipping NuGet package signature verification. ```
arm64 fails ```text #14 41.45 [NuGet Manager] [Info] GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-sonarscanner/index.json #14 41.58 [NuGet Manager] [Info] OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-sonarscanner/index.json 131ms #14 42.06 Unhandled exception: System.NullReferenceException: Object reference not set to an instance of an object. ```
gray380 commented 2 weeks ago

Looks similar to #43651.

yes, but they faced issue with 9 in my case it is 8