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

[DCR]: NuGet SDK resolver should cache global.json itself #11450

Closed
jeffkl opened this issue Dec 11, 2021 · 0 comments · Fixed by NuGet/NuGet.Client#4380
Closed

[DCR]: NuGet SDK resolver should cache global.json itself #11450

jeffkl opened this issue Dec 11, 2021 · 0 comments · Fixed by NuGet/NuGet.Client#4380
Assignees
Labels
Priority:2 Issues for the current backlog. Product:MSBuildSDKResolver The NuGet powered SDK resolver. Owned by MSBuild team Type:DCR Design Change Request

Comments

@jeffkl
Copy link
Contributor

jeffkl commented Dec 11, 2021

NuGet Product(s) Affected

MSBuild.exe, dotnet.exe

Current Behavior

Currently the NuGet SDK resolver relies on the MSBuild SDK resolver APIs to save state. However, the state is not guaranteed to be thread-safe and so currently the NuGet SDK resolver is parsing global.json many times by Visual Studio. This is because the state is only set after a resolver completes and the cache key is a build submission. Visual Studio issues several design time builds will load global.json over and over.

Desired Behavior

The NuGet SDK resolver should have its own file cache that only loads a file once unless it has changed.

Additional Context

No response

@jeffkl jeffkl added Priority:2 Issues for the current backlog. Type:DCR Design Change Request Product:MSBuildSDKResolver The NuGet powered SDK resolver. Owned by MSBuild team Pipeline:Backlog labels Dec 11, 2021
@jeffkl jeffkl self-assigned this Dec 11, 2021
@nkolev92 nkolev92 added this to the Sprint 2021-12 milestone Dec 13, 2021
jeffkl added a commit to NuGet/NuGet.Client that referenced this issue Jan 3, 2022
The MSBuild SDK resolver APIs provide some state but it is not thread-safe.  This results in the NuGet SDK resolver loading and parsing global.json N times in Visual Studio, once for solution load and once for every design time build.

This change introduces a file cache based on path and last write time that is thread-safe.

I also changed how global.json is parsed to help speed up the process.

Fixes NuGet/Home#11450
Related to NuGet/Home#11443
@jeffkl jeffkl modified the milestones: Sprint 2021-12, Sprint 2022-01 Jan 3, 2022
jeffkl added a commit to NuGet/NuGet.Client that referenced this issue Jan 12, 2022
The MSBuild SDK resolver APIs provide some state but it is not thread-safe.  This results in the NuGet SDK resolver loading and parsing global.json N times in Visual Studio, once for solution load and once for every design time build.

This change introduces a file cache based on path and last write time that is thread-safe.

I also changed how global.json is parsed to help speed up the process.

Fixes NuGet/Home#11450
Related to NuGet/Home#11443
jeffkl added a commit to NuGet/NuGet.Client that referenced this issue Feb 2, 2022
The MSBuild SDK resolver APIs provide some state but it is not thread-safe.  This results in the NuGet SDK resolver loading and parsing global.json N times in Visual Studio, once for solution load and once for every design time build.

This change introduces a file cache based on path and last write time that is thread-safe.

I also changed how global.json is parsed to help speed up the process.

Fixes NuGet/Home#11450
Related to NuGet/Home#11443
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:MSBuildSDKResolver The NuGet powered SDK resolver. Owned by MSBuild team Type:DCR Design Change Request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants