microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.44k stars 2.6k forks source link

[BUG]: UseDotNet@2 installs a weird mix of build and runtime SDKs for dotnet 6.* - caused DotNetCoreCLI@2 "dotnet restore" failure #19171

Open turbobobbytraykov opened 9 months ago

turbobobbytraykov commented 9 months ago

Task name

UseDotNet

Task version

2.228.0

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows Server 2016 Standard & 2012 R2

Task log

Starting: Install dotnet if not already present
==============================================================================
Task         : Use .NET Core
Description  : Acquires a specific version of the .NET Core SDK from the internet or the local cache and adds it to the PATH. Use this task to change the version of .NET Core used in subsequent tasks. Additionally provides proxy support.
Version      : 2.228.0
Author       : Microsoft Corporation
Help         : https://aka.ms/AA4xgy0
==============================================================================
Tool to install: .NET Core sdk version 6.x.
Found version 6.0.416 in channel 6.0 for user specified version spec: 6.x
Version: 6.0.416 was found in cache.
Creating global tool path and pre-pending to PATH.
Finishing: Install dotnet if not already present

Relevant log output

#[section]Starting: dotnet restore
=============================================================================
ask         : .NET Core
escription  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
ersion      : 2.221.0
uthor       : Microsoft Corporation
elp         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
=============================================================================
command]C:\Windows\system32\chcp.com 65001
ctive code page: 65001
nfo: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
command]AGENT_HOMEDIRECTORY\_work\_tool\dotnet\dotnet.exe restore REDACTED_PROJECT_PATH --configfile AGENT_HOMEDIRECTORY\_work\18\Nuget\tempNuGet_118721.config --verbosity Diagnostic
GENT_HOMEDIRECTORY\_work\_tool\dotnet\sdk\6.0.416\MSBuild.dll -nologo -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,AGENT_HOMEDIRECTORY\_work\_tool\dotnet\sdk\6.0.416\dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,AGENT_HOMEDIRECTORY\_work\_tool\dotnet\sdk\6.0.416\dotnet.dll -maxcpucount -property:RestoreConfigFile=AGENT_HOMEDIRECTORY\_work\18\Nuget\tempNuGet_118721.config -target:Restore -verbosity:m -verbosity:diagnostic REDACTED_PROJECT_PATH.csproj
uild started 10/26/2023 6:37:04 PM.
8:37:06.636   1:5>ProcessFrameworkReferences: (TargetId:41)
Output Item(s): 
_PackageToDownload=
Microsoft.NETCore.App.Runtime.Mono.browser-wasm
Version=6.0.24 (TaskId:39)

PackageConflictPreferredPackages=Microsoft.NETCore.App.Ref;Microsoft.NETCore.App.Runtime.Mono.linux-arm;Microsoft.NETCore.App.Runtime.Mono.linux-arm64;Microsoft.NETCore.App.Runtime.Mono.linux-musl-arm64;Microsoft.NETCore.App.Runtime.Mono.linux-musl-x64;Microsoft.NETCore.App.Runtime.Mono.linux-x64;Microsoft.NETCore.App.Runtime.Mono.osx-x64;Microsoft.NETCore.App.Runtime.Mono.rhel.6-x64;Microsoft.NETCore.App.Runtime.Mono.win-arm;Microsoft.NETCore.App.Runtime.Mono.win-arm64;Microsoft.NETCore.App.Runtime.Mono.win-x64;Microsoft.NETCore.App.Runtime.Mono.win-x86;Microsoft.NETCore.App.Runtime.Mono.linux-musl-arm;Microsoft.NETCore.App.Runtime.Mono.osx-arm64;Microsoft.NETCore.App.Runtime.Mono.maccatalyst-x64;Microsoft.NETCore.App.Runtime.Mono.maccatalyst-arm64;Microsoft.NETCore.App.Runtime.Mono.linux-s390x;Microsoft.NETCore.App.Runtime.Mono.browser-wasm;Microsoft.NETCore.App.Runtime.Mono.ios-arm64;Microsoft.NETCore.App.Runtime.Mono.ios-arm;Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64;Microsoft.NETCore.App.Runtime.Mono.iossimulator-x64;Microsoft.NETCore.App.Runtime.Mono.iossimulator-x86;Microsoft.NETCore.App.Runtime.Mono.tvos-arm64;Microsoft.NETCore.App.Runtime.Mono.tvossimulator-arm64;Microsoft.NETCore.App.Runtime.Mono.tvossimulator-x64;Microsoft.NETCore.App.Runtime.Mono.android-arm64;Microsoft.NETCore.App.Runtime.Mono.android-arm;Microsoft.NETCore.App.Runtime.Mono.android-x64;Microsoft.NETCore.App.Runtime.Mono.android-x86
PackageDirectory=AGENT_HOMEDIRECTORY\_work\_tool\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.24
Path=AGENT_HOMEDIRECTORY\_work\_tool\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.24
RuntimeFrameworkName=Microsoft.NETCore.App
RuntimePackRuntimeIdentifiers=linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;linux-s390x;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86
TargetFramework=net6.0
TargetingPackFormat=
Microsoft.WindowsDesktop.App
NuGetPackageId=Microsoft.WindowsDesktop.App.Ref
NuGetPackageVersion=6.0.24

Output Item(s): 
RuntimePack=
Microsoft.NETCore.App.Runtime.Mono.browser-wasm
FrameworkName=Microsoft.NETCore.App
IsTrimmable=
NuGetPackageId=Microsoft.NETCore.App.Runtime.Mono.browser-wasm
NuGetPackageVersion=6.0.24
RuntimeIdentifier=browser-wasm (TaskId:39)

Restoring packages for REDACTED_PROJECT_PATH.csproj... (TaskId:65)
Restoring packages for .NETCoreApp,Version=v6.0... (TaskId:65)
Resolving conflicts for net6.0... (TaskId:65)
GET ***FindPackagesById()?id='Microsoft.NETCore.App.Runtime.Mono.browser-wasm'&semVerLevel=2.0.0 (TaskId:65)
BadRequest ***FindPackagesById()?id='Microsoft.NETCore.App.Runtime.Mono.browser-wasm'&semVerLevel=2.0.0 40ms (TaskId:65)
Retrying 'FindPackagesByIdAsyncCore' for source '***FindPackagesById()?id='Microsoft.NETCore.App.Runtime.Mono.browser-wasm'&semVerLevel=2.0.0'.
Response status code does not indicate success: 400 (Bad Request). (TaskId:65)
Enhanced retry: HttpRetryHandler is in a state that retry would have been abandoned or not waited if it were not enabled. (TaskId:65)
GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app.runtime.mono.browser-wasm/index.json (TaskId:65)

OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app.runtime.mono.browser-wasm/index.json 138ms (TaskId:65)
Acquiring lock for the installation of Microsoft.NETCore.App.Runtime.Mono.browser-wasm 6.0.24 (TaskId:65)
Acquired lock for the installation of Microsoft.NETCore.App.Runtime.Mono.browser-wasm 6.0.24 (TaskId:65)
GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app.runtime.mono.browser-wasm/6.0.24/microsoft.netcore.app.runtime.mono.browser-wasm.6.0.24.nupkg (TaskId:65)
OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app.runtime.mono.browser-wasm/6.0.24/microsoft.netcore.app.runtime.mono.browser-wasm.6.0.24.nupkg 7ms (TaskId:65)
GET ***FindPackagesById()?id='Microsoft.NETCore.App.Runtime.Mono.browser-wasm'&semVerLevel=2.0.0 (TaskId:65)
BadRequest ***FindPackagesById()?id='Microsoft.NETCore.App.Runtime.Mono.browser-wasm'&semVerLevel=2.0.0 19ms (TaskId:65)
Retrying 'FindPackagesByIdAsyncCore' for source '***FindPackagesById()?id='Microsoft.NETCore.App.Runtime.Mono.browser-wasm'&semVerLevel=2.0.0'.
Response status code does not indicate success: 400 (Bad Request). (TaskId:65)
Enhanced retry: HttpRetryHandler is in a state that retry would have been abandoned or not waited if it were not enabled. (TaskId:65)
PackageSignatureVerificationLog: PackageIdentity: Microsoft.NETCore.App.Runtime.Mono.browser-wasm.6.0.24 Source: https://api.nuget.org/v3/index.json PackageSignatureValidity: True (TaskId:65)
GET ***FindPackagesById()?id='Microsoft.NETCore.App.Runtime.Mono.browser-wasm'&semVerLevel=2.0.0 (TaskId:65)
BadRequest ***FindPackagesById()?id='Microsoft.NETCore.App.Runtime.Mono.browser-wasm'&semVerLevel=2.0.0 17ms (TaskId:65)
8:37:09.399     1>REDACTED_PROJECT_PATH.csproj : error NU1301: Failed to retrieve information about 'Microsoft.NETCore.App.Runtime.Mono.browser-wasm' from remote source '***FindPackagesById()?id='Microsoft.NETCore.App.Runtime.Mono.browser-wasm'&semVerLevel=2.0.0'.
8:37:09.399     1>REDACTED_PROJECT_PATH.csproj : error NU1301: Failed to retrieve information about 'Microsoft.NETCore.App.Runtime.Mono.browser-wasm' from remote source '***FindPackagesById()?id='Microsoft.NETCore.App.Runtime.Mono.browser-wasm'&semVerLevel=2.0.0'.
Installed Microsoft.NETCore.App.Runtime.Mono.browser-wasm 6.0.24 from https://api.nuget.org/v3/index.json with content hash XC/y2xP3KKfjs36vY95ucWw+0DVB9MJJSU5jpBjo+PqIB8EHOpBrUTMeZQh0Bjox3/5AmBWKEDCov6Er1ETuQg==. (TaskId:65)

Done executing task "RestoreTask" -- FAILED. (TaskId:65)
8:37:11.179     1>Done building target "Restore" in project "REDACTED.csproj" -- FAILED.: (TargetId:75)
8:37:11.179     1>Done Building Project "REDACTED_PROJECT_PATH.csproj" (Restore target(s)) -- FAILED.

uild FAILED.

"REDACTED_PROJECT_PATH.csproj" (Restore target) (1) ->
(Restore target) -> 
REDACTED_PROJECT_PATH.csproj : error NU1301: Failed to retrieve information about 'Microsoft.NETCore.App.Runtime.Mono.browser-wasm' from remote source '***FindPackagesById()?id='Microsoft.NETCore.App.Runtime.Mono.browser-wasm'&semVerLevel=2.0.0'.
REDACTED_PROJECT_PATH.csproj : error NU1301: Failed to retrieve information about 'Microsoft.NETCore.App.Runtime.Mono.browser-wasm' from remote source '***FindPackagesById()?id='Microsoft.NETCore.App.Runtime.Mono.browser-wasm'&semVerLevel=2.0.0'.

2 Error(s)

ime Elapsed 00:00:06.79
#[error]Error: The process 'AGENT_HOMEDIRECTORY\_work\_tool\dotnet\dotnet.exe' failed with exit code 1
#[error]Packages failed to restore
nfo: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
#[section]Finishing: dotnet restore

Aditional info

The problem appeared on 2 VMs which have been running this pipeline for nearly a year at a frequent pace. UseDotNet@2 has always been 6.x during this time so this is the first time this issue has happened.

Hardcoding version '6.1.415' worked.
Deleting the _tool\dotnet dirs also helped get the latest 6.x to work as well.

Good pairs that work: 6.0.415+6.0.23 and 6.0.416+6.0.24 - as per the dotnet release notes.
Bad pair that did not work: 6.0.415+6.0.24
github-actions[bot] commented 3 months ago

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

turbobobbytraykov commented 3 months ago

Bump. Has anyone else encountered in recent times? It still happens occasionally in my organization, but we have mitigated it.