Skip to content

MSB4181: The "Restore Task" task returned false but did not log an error. #13460

Closed
NuGet/NuGet.Client
#5845
@donnie-msft

Description

@donnie-msft

NuGet Product Used

dotnet.exe, MSBuild.exe, NuGet.exe, Visual Studio Package Management UI

Product Version

Repro'd at least back to 17.9

Worked before?

Yes, not sure

Impact

It's more difficult to complete my work

Repro Steps & Context

Particular restore errors are no longer being logged, so it's very difficult for customers to know why restore is failing.
In my case, I can repro this by adding a package reference for a package which exists on a feed, but I'm not authorized to download.

  1. Add an Azure DevOps feed to your config.
  2. Configure an upstream feed which requires authentication.
  3. Remove any credentials that would authenticate your account on the upstream feed.
  4. Add a PackageReference for a package version that is on the Upstream feed but not the Main feed.
  5. Attempt to restore - even with detailed verbosity - and the following error results:
    msbuild src\NuGet.Clients\NuGet.PackageManagement.PowerShellCmdlets\NuGet.PackageManagement.PowerShellCmdlets.csproj /t:restore /clp:v=n

    error MSB4181: The "Restore Task" task returned false but did not log an error.

The actual error I found while debugging, which I expect to be logged, is:

NuGet.Protocol.Core.Types.FatalProtocolException: 'The feed 'vside [https://pkgs.dev.azure.com/azure-public/vside/_packaging/msft_consumption/nuget/v3/index.json]' lists package 'Microsoft.Internal.VisualStudio.Shell.Framework.17.8.37385' but multiple attempts to download the nupkg have failed. The feed is either invalid or required packages were removed while the current operation was in progress. Verify the package exists on the feed and try again.'

Unable to find package 'Microsoft.Internal.VisualStudio.Shell.Framework.17.8.37385'.
at NuGet.Protocol.FindPackagesByIdNupkgDownloader.d__7.MoveNext() in C:\NuGet.Client\src\NuGet.Core\NuGet.Protocol\Utility\FindPackagesByIdNupkgDownloader.cs:line 90
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at NuGet.Protocol.HttpFileSystemBasedFindPackageByIdResource.<GetDependencyInfoAsync>d__12.MoveNext() in C:\NuGet.Client\src\NuGet.Core\NuGet.Protocol\RemoteRepositories\HttpFileSystemBasedFindPackageByIdResource.cs:line 200 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at NuGet.Commands.SourceRepositoryDependencyProvider.d__26.MoveNext() in C:\NuGet.Client\src\NuGet.Core\NuGet.Commands\RestoreCommand\SourceRepositoryDependencyProvider.cs:line 369
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at NuGet.TaskResultCache2.<>c__51.<GetOrAddAsync>b__5_1(Task1 task) in C:\NuGet.Client\build\Shared\TaskResultCache.cs:line 98
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

Verbose Logs

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions