Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/Shared/SolutionConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ internal sealed class SolutionConfiguration
public static readonly char[] ConfigPlatformSeparator = { '|' };

// This field stores pre-cached project elements for project guids for quicker access by project guid
private readonly Dictionary<string, XmlElement> _cachedProjectElements = new Dictionary<string, XmlElement>(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<string, XmlElement> _cachedProjectElements;

// This field stores pre-cached project elements for project guids for quicker access by project absolute path
private readonly Dictionary<string, XmlElement> _cachedProjectElementsByAbsolutePath = new Dictionary<string, XmlElement>(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<string, XmlElement> _cachedProjectElementsByAbsolutePath;

// This field stores the project absolute path for quicker access by project guid
private readonly Dictionary<string, string> _cachedProjectAbsolutePathsByGuid = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<string, string> _cachedProjectAbsolutePathsByGuid;

// This field stores the project guid for quicker access by project absolute path
private readonly Dictionary<string, string> _cachedProjectGuidsByAbsolutePath = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<string, string> _cachedProjectGuidsByAbsolutePath;

// This field stores the list of dependency project guids by depending project guid
private readonly Dictionary<string, List<string>> _cachedDependencyProjectGuidsByDependingProjectGuid = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<string, List<string>> _cachedDependencyProjectGuidsByDependingProjectGuid;

public SolutionConfiguration(string xmlString)
{
Expand All @@ -44,7 +44,16 @@ public SolutionConfiguration(string xmlString)
// <ProjectConfiguration Project="{4A727FF8-65F2-401E-95AD-7C8BBFBE3167}" AbsolutePath="c:foo\Project3\C.csproj" BuildProjectInSolution="True">Debug|AnyCPU</ProjectConfiguration>
// </SolutionConfiguration>
//

XmlNodeList? projectConfigurationElements = GetProjectConfigurations(xmlString);
int projectConfigurationCount = projectConfigurationElements?.Count ?? 0;

_cachedProjectElements = new Dictionary<string, XmlElement>(projectConfigurationCount, StringComparer.OrdinalIgnoreCase);
_cachedProjectElementsByAbsolutePath = new Dictionary<string, XmlElement>(projectConfigurationCount, StringComparer.OrdinalIgnoreCase);
_cachedProjectAbsolutePathsByGuid = new Dictionary<string, string>(projectConfigurationCount, StringComparer.OrdinalIgnoreCase);
_cachedProjectGuidsByAbsolutePath = new Dictionary<string, string>(projectConfigurationCount, StringComparer.OrdinalIgnoreCase);
_cachedDependencyProjectGuidsByDependingProjectGuid = new Dictionary<string, List<string>>(projectConfigurationCount, StringComparer.OrdinalIgnoreCase);

if (projectConfigurationElements != null)
{
foreach (XmlElement xmlElement in projectConfigurationElements)
Expand Down