diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/SymbolTree/RootSymbolTreeItemSourceProvider.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/SymbolTree/RootSymbolTreeItemSourceProvider.cs index 2e4bb424200fc..972bab8d8b786 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/SymbolTree/RootSymbolTreeItemSourceProvider.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/SymbolTree/RootSymbolTreeItemSourceProvider.cs @@ -116,7 +116,10 @@ private async ValueTask UpdateCollectionSourcesAsync( lock (_filePathToCollectionSources) { foreach (var filePath in updatedFilePaths) - sources.AddRange(_filePathToCollectionSources[filePath]); + { + if (_filePathToCollectionSources.TryGetValue(filePath, out var pathSources)) + sources.AddRange(pathSources); + } } // Update all the affected documents in parallel.