Update ProjectSystemCache to be case insensitive for _primaryCache #6055
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug
Fixes: https://github.com/NuGet/Client.Engineering/issues/2829
Description
Projects information was being added/updated with different cases, causes our apex tests to fail. The primary key for the _primaryCache is projectNames.FullName which is the full path and filename of the project. Switching the dictionary to ignore case allows the project to be added to the single entry instead of creating a new one.
When we load an empty solution, there are no projects, and VsSolutionManager.EnsureNuGetAndVsProjectAdapterCacheAsync does not initialize the cache.
When we create a new project we call VsSolutionManager.OnEnvDTEProjectAdded which attempts to initialize the cache again then add the project.
EnsureNuGetAndVsProjectAdapterCacheAsync gets the project name from
NuGet.Client/src/NuGet.Clients/NuGet.VisualStudio.Common/IDE/VsHierarchyUtility.cs
Lines 37 to 43 in 0bf00d2
Then later in OnEnVDTEProjectedAdded we get the full name from the EnvDTE.Project full name
NuGet.Client/src/NuGet.Clients/NuGet.VisualStudio.Common/ProjectSystems/ProjectNames.cs
Line 92 in 0bf00d2
PR Checklist
Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.