NuGetSdkResolver loads global.json multiple times during project load #12819
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
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 readglobal.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 theGlobalJsonReader
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
The text was updated successfully, but these errors were encountered: