NuGet / Home

Repo for NuGet Client issues
Other
1.49k stars 250 forks source link

Update documentation for INuGetProjectService.GetInstalledPackagesAsync() to show that projects can be returned with result.Packages with empty InstallPath #13681

Closed ocallesp closed 2 days ago

ocallesp commented 1 month ago

NuGet Product Used

NuGet SDK, Other/NA

Product Version

17.10.5

Worked before?

Yes

Impact

It's more difficult to complete my work

Repro Steps & Context

Test Explorer in Visual Studio 2022 is having pretty bad performance due to an issue in INuGetProjectService.GetInstalledPackagesAsync() returning result.Packages with empty InstallPath

Repro:

[8/1/2024 5:01:37.677 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.Common' referenced in project 'Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.
[8/1/2024 5:01:37.771 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.Common' referenced in project 'Microsoft.Build.Tasks.CodeAnalysis.UnitTests'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.
[8/1/2024 5:01:37.780 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.Common' referenced in project 'Microsoft.CodeAnalysis.CSharp.ExpressionCompiler.UnitTests'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.
[8/1/2024 5:01:37.820 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.Common' referenced in project 'Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.
[8/1/2024 5:01:37.821 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.CSharp.Workspaces' referenced in project 'Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.
[8/1/2024 5:01:37.821 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.VisualBasic.Workspaces' referenced in project 'Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.
[8/1/2024 5:01:37.821 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.Workspaces.Common' referenced in project 'Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.
[8/1/2024 5:01:39.673 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.Common' referenced in project 'Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.
[8/1/2024 5:01:46.635 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.Common' referenced in project 'Microsoft.CodeAnalysis.LanguageServer.Protocol.Test.Utilities'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.
[8/1/2024 5:01:46.635 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.CSharp.Workspaces' referenced in project 'Microsoft.CodeAnalysis.LanguageServer.Protocol.Test.Utilities'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.

...
[8/1/2024 5:03:44.886 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.Common' referenced in project 'Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.
[8/1/2024 5:03:44.886 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.CSharp.Workspaces' referenced in project 'Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.
[8/1/2024 5:03:44.886 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.VisualBasic.Workspaces' referenced in project 'Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.
[8/1/2024 5:03:44.886 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.Workspaces.Common' referenced in project 'Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.
[8/1/2024 5:03:45.253 PM]  Failed to determine installation location for NuGet package 'Microsoft.CodeAnalysis.Common' referenced in project 'Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests'. Check to make sure that a NuGet restore operation has been performed for this project and that no errors were reported during this operation.

Verbose Logs

No response

Nigusu-Allehu commented 1 month ago

image If you are referring to this test, I was not able to reproduce the issue. Have you tried rebuilding the project and then running the test?

zivkan commented 1 month ago

@Nigusu-Allehu the report does not say that the test fails to execute. Test Explorer calls NuGet's GetInstalledPackagesAsync API, and items returned from that API have a null value for InstallPath.

In this case, all of the identifiers returned in the warning message are projects in the solution, not packages downloaded and extracted to the packages directory.

I think it's questionable if GetInstalledPackagesAsync should return projects. It will, however, be a breaking change, since the API has been returning projects for years now. We have no way of knowing if anyone using the API has taken a dependency on knowing the (transitive) project references via NuGet.

dotnet-policy-service[bot] commented 2 weeks ago

This issue has been automatically marked as stale because we have not received a response in 14 days. It will be closed if no further activity occurs within another 14 days of this comment.