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

[NuGet.VisualStudioExtension] IVsPackageInstallerServices.GetInstalledPackages returns zero in 2015 #313

Closed
deepakaravindr opened this issue Mar 31, 2015 · 3 comments
Labels
Priority:2 Issues for the current backlog. Product:VS.Client Type:Bug
Milestone

Comments

@deepakaravindr
Copy link

@kzu,

Here's a repro xunit test for VS2015: http://cloud.cazzulino.com/NuGetTests.7z

May be related to #13.

This is a blocker for a feature in Xamarin that retargets nuget packages when migrating a project from "Classic" to the new "Unified" API (from MonoTouch target framework to Xamarin.iOS).

@deepakaravindr deepakaravindr added Product:VS.Client Priority:2 Issues for the current backlog. Type:Bug labels Mar 31, 2015
@deepakaravindr deepakaravindr added this to the 3.0.0-rc2 milestone Mar 31, 2015
@deepakaravindr
Copy link
Author

This is fixed

@kzu
Copy link

kzu commented Apr 10, 2015

Awesome!

On Thu, Apr 9, 2015, 7:13 PM Deepak Aravindakshan notifications@github.com
wrote:

This is fixed

Reply to this email directly or view it on GitHub
#313 (comment).

@cbries
Copy link

cbries commented Jan 10, 2019

Are you sure it is fixed?

Right now I have this problem. I am still analyzing the issue, but
IEnumerable GetInstalledPackages();
and
IEnumerable GetInstalledPackages(Project project)
return zero.

But "nuget restore" prints: "All packages are listed in packages.config are installed."

Btw. tested on Vs17.9.5, Vs17-preview and Vs19-preview

Supplement:
As I see in the sources the returned list will be zero in case the methods are called when the solution is not available...
public IEnumerable<IVsPackageMetadata> GetInstalledPackages() {
var packages = new HashSet<IVsPackageMetadata>(new VsPackageMetadataComparer());
return NuGetUIThreadHelper.JoinableTaskFactory.Run(async delegate {
// Calls may occur in the template wizard before the solution is actually created,
// in that case return no projects
if (_solutionManager != null
&& !string.IsNullOrEmpty(_solutionManager.SolutionDirectory))
[[snip]]

The call of GetInstalledPackages() is done in a IProjectEvents event, named "AfterProjectFileOpened", which in turn "optionally requires" a solution file (in my context it is already their) but probably is not loaded before the "AfterProjectFileOpened"-event is fired. Strange...

Supplement 2:
My first thought in the previous notes looks correct.
Within the event handler dte2.Events.SolutionEvents.Opened += SolutionEvents_Opened; the list of packages is correctly returned; but a way to late in my current scenario...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:2 Issues for the current backlog. Product:VS.Client Type:Bug
Projects
None yet
Development

No branches or pull requests

3 participants