Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unable to gather dependency information for multiple packages" when updating a project with at least one package where none of the packages exists on the target source #5884

Closed
bronumski opened this issue Sep 13, 2017 · 5 comments
Labels
Product:NuGet.exe NuGet.exe Resolution:Duplicate This issue appears to be a Duplicate of another issue Triage:NeedsTriageDiscussion
Milestone

Comments

@bronumski
Copy link

bronumski commented Sep 13, 2017

Details about Problem

Nuget update exists with an exit code of 1 and a message of "Unable to gather dependency information for multiple packages" when updating a project that has at least one nuget package and none of the nuget packages exist on the source.

We have a solution which is built on TeamCity this solution has multiple internal dependencies that live as nuget artifacts on TeamCity. Nightly we run a build that updates all the internal nuget dependencies to ensure there are no breaking changes should we do an update. When updating a project that does not have any internal nuget dependencies but has at least one nuget dependency the update fails with the message above. This does not happen if the packages.config contains no packages.

NuGet product used NuGet.exe

NuGet version (3.5 - 4.3):

OS version (Multiple versions of windows)):

Worked before? If so, with which NuGet version: 2.12.0

Verbose Logs

<packages>
  <package id="EPPlus" version="4.0.4" targetFramework="net40" />
  <package id="StatsdClient" version="3.0.86" targetFramework="net451" />
  <package id="StyleCop.MSBuild" version="4.7.54.0" targetFramework="net40" developmentDependency="true" />
  <package id="Unofficial.Microsoft.SQLServer.SMO.2014" version="12.0.2000.8" targetFramework="net40" />
</packages>

From 3.5

NuGet.exe update <project>\packages.config -FileConflictAction Overwrite -Source https://<teamcity>/httpAuth/app/nuget/v1/FeedService.svc -RepositoryPath packages -Verbosity detailed
NuGet Version: 3.5.0.1996
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Looking for installed packages in 'packages'.
Feeds used:
  https://<teamcity>/httpAuth/app/nuget/v1/FeedService.svc



Attempting to gather dependency information for multiple packages with respect to project '<proj>', targeting '.NETFramework,Version=v4.5.1'
  GET https://<teamcity>/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='StyleCop.MSBuild'
  GET https://<teamcity>/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='StatsdClient'
  GET https://<teamcity>/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='EPPlus'
  GET https://<teamcity>/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Unofficial.Microsoft.SQLServer.SMO.2014'
  OK https://<teamcity>/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='EPPlus' 189ms
  OK https://<teamcity>/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='StyleCop.MSBuild' 191ms
  OK https://<teamcity>/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Unofficial.Microsoft.SQLServer.SMO.2014' 204ms

  OK https://<teamcity>/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='StatsdClient' 225ms
Total number of results gathered : 4
Gathering dependency information took 1.43 sec
Summary of time taken to gather dependencies per source :
https://<teamcity>/httpAuth/app/nuget/v1/FeedService.svc     -       896.18 ms
System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Unable to gather dependency information for multiple packages
   at NuGet.PackageManagement.NuGetPackageManager.<PreviewUpdatePackagesForClassicAsync>d__51.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.PackageManagement.NuGetPackageManager.<PreviewUpdatePackagesAsync>d__49.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NuGet.CommandLine.UpdateCommand.<UpdatePackagesAsync>d__46.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.CommandLine.UpdateCommand.<ExecuteCommandAsync>d__39.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at NuGet.CommandLine.Command.Execute()
   at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
---> (Inner Exception #0) System.InvalidOperationException: Unable to gather dependency information for multiple packages
   at NuGet.PackageManagement.NuGetPackageManager.<PreviewUpdatePackagesForClassicAsync>d__51.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.PackageManagement.NuGetPackageManager.<PreviewUpdatePackagesAsync>d__49.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NuGet.CommandLine.UpdateCommand.<UpdatePackagesAsync>d__46.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.CommandLine.UpdateCommand.<ExecuteCommandAsync>d__39.MoveNext()<---

Just stack trace from 4.3

Unable to gather dependency information for multiple packages
System.InvalidOperationException: Unable to gather dependency information for multiple packages
   at NuGet.PackageManagement.NuGetPackageManager.<PreviewUpdatePackagesForClassicAsync>d__59.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.PackageManagement.NuGetPackageManager.<PreviewUpdatePackagesAsync>d__56.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.CommandLine.UpdateCommand.<UpdatePackagesAsync>d__50.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.CommandLine.UpdateCommand.<ExecuteCommandAsync>d__43.MoveNext()
@zhili1208
Copy link
Contributor

Could you try to specify nuget.org as your source like following?

NuGet.exe update <project>\packages.config -FileConflictAction Overwrite -Source "https://<teamcity>/httpAuth/app/nuget/v1/FeedService.svc;https://api.nuget.org/v3/index.json" -RepositoryPath packages -Verbosity detailed

@bronumski
Copy link
Author

@zhili1208 - If I include both of the sources that is going to work as it will find the other package on the official feed.

To be clear I do not want to do an update against the official feed because I am only interested in updating internal packages and not external 3rd party packages. This was working as of 2.12.0 but we now need to move to a newer version of nuget. If the packages.config is empty then the update does not fail but obviously nothing is updated. If the packages.config contains at least one packages that exists on the target source it will also complete successfully even if there are packages that do not exist on the target source.

For completeness I have run an update using a package.config only contains internal packages that will not exist on the official feed. If I try to do an update against the official feed I get the same error.

<packages>
  <package id="internal.package" version="1.0.156" targetFramework="net40" />
</packages>
NuGet.exe update <proj>\packages.config -FileConflictAction Overwrite -Source https://api.nuget.org/v3/index.json -RepositoryPath packages -Verbosity detailed
NuGet Version: 4.3.0.4406
MSBuild auto-detection: using msbuild version '15.1.1012.6693' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Looking for installed packages in 'packages'.
Feeds used:
  https://api.nuget.org/v3/index.json



Attempting to gather dependency information for multiple packages with respect to project '<proj>', targeting '.NETFramework,Version=v4.5.1'
  GET https://api.nuget.org/v3/registration3-gz-semver2/intz/index.json
  NotFound https://api.nuget.org/v3/registration3-gz-semver2/intz/index.json 240ms
Total number of results gathered : 1
Gathering dependency information took 863.92 ms
Summary of time taken to gather dependencies per source :
https://api.nuget.org/v3/index.json     -       285.37 ms
Unable to gather dependency information for multiple packages
System.InvalidOperationException: Unable to gather dependency information for multiple packages
   at NuGet.PackageManagement.NuGetPackageManager.<PreviewUpdatePackagesForClassicAsync>d__59.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.PackageManagement.NuGetPackageManager.<PreviewUpdatePackagesAsync>d__56.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.CommandLine.UpdateCommand.<UpdatePackagesAsync>d__50.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.CommandLine.UpdateCommand.<ExecuteCommandAsync>d__43.MoveNext()

@bronumski bronumski changed the title "Unable to gather dependency information for multiple packages" when updating a project with at least one package where none of the packages exists on the target host "Unable to gather dependency information for multiple packages" when updating a project with at least one package where none of the packages exists on the target source Sep 13, 2017
@zhili1208 zhili1208 added this to the Backlog milestone Sep 14, 2017
@rrelyea
Copy link
Contributor

rrelyea commented Sep 21, 2017

If I understand what @zhili1208 just told me about this issue, it sounds like you have a set of internal packages and external packages. You'd like to lock down version of the external packages, and no be presented updates for those packages.
This general area is a type of scenario we understand and are trying to design for with some work for repeatable builds (lineups).
Pay attention to the lineups issue here: #2572

Given that, we're going to close this issue. Because we'd like to support this through lineups and not by changing our error behavior in this case. Thanks.

@rrelyea rrelyea closed this as completed Sep 21, 2017
@rrelyea rrelyea added the Resolution:Duplicate This issue appears to be a Duplicate of another issue label Sep 21, 2017
@rrelyea rrelyea modified the milestones: Backlog, 4.4 Sep 21, 2017
@bronumski
Copy link
Author

bronumski commented Sep 23, 2017

@rrelyea - Yes that is pretty much it however the current behaviour does not feel right given the following scenarios.

Given I have a nuget packages file
And the packages file contains no package references
When I run a nuget update for the packages file against source A
Then no error is thrown
And no packages are updated

Given I have a nuget packages file
And the packages file has a reference to a package on source A
And the packages file has a reference to a package on source B
When I run a nuget update for the packages file against source A
Then no error is thrown
And the referenced package on source A is updated

Given I have a nuget packages file
And the packages file has a reference to a package on source B
When I run a nuget update for the packages file against source A
Then an error is thrown

I would have expected the last scenario to behave the same was as the first scenario. Also this is a breaking change from version 2.x as version 2.x handles the last scenario the same way as the first.

@bronumski
Copy link
Author

bronumski commented Sep 27, 2017

@rrelyea - Did you have a chance to review the above and any consideration for reopening? This is causing us issues from moving from nuget v2x to v4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product:NuGet.exe NuGet.exe Resolution:Duplicate This issue appears to be a Duplicate of another issue Triage:NeedsTriageDiscussion
Projects
None yet
Development

No branches or pull requests

3 participants