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

NuGetSdkResolver loads global.json multiple times during project load #12819

Closed
jeffkl opened this issue Aug 17, 2023 · 0 comments · Fixed by NuGet/NuGet.Client#5364
Closed
Assignees
Labels
Category:Quality Week Issues that should be considered for quality week Priority:2 Issues for the current backlog. Product:MSBuildSDKResolver The NuGet powered SDK resolver. Owned by MSBuild team Type:Bug
Milestone

Comments

@jeffkl
Copy link
Contributor

jeffkl commented Aug 17, 2023

NuGet Product Used

MSBuild.exe

Product Version

All

Worked before?

No response

Impact

It bothers me. A fix would be nice

Repro Steps & Context

The NuGetSdkResolver uses a class to read global.json. I added a caching mechanism to this class so that it would not read global.json more than once unless it changed on disk. However, during project evaluation MSBuild is calling the NuGetSdkResolver in a way that means that multiple instances of the GlobalJsonReader class are instantiated. We should use a static singleton instead.

https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/Microsoft.Build.NuGetSdkResolver/NuGetSdkResolver.cs#L43

I found this by manually debugging the SDK resolver while investigating something else.

Verbose Logs

No response

@jeffkl jeffkl added Triage:Untriaged Type:Bug Priority:2 Issues for the current backlog. Product:MSBuildSDKResolver The NuGet powered SDK resolver. Owned by MSBuild team Category:Quality Week Issues that should be considered for quality week and removed Triage:Untriaged labels Aug 17, 2023
@jeffkl jeffkl self-assigned this Aug 17, 2023
jeffkl added a commit to NuGet/NuGet.Client that referenced this issue Aug 17, 2023
@zivkan zivkan added this to the 6.8 milestone Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category:Quality Week Issues that should be considered for quality week Priority:2 Issues for the current backlog. Product:MSBuildSDKResolver The NuGet powered SDK resolver. Owned by MSBuild team Type:Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants