From e40fc57624e0a4fc68829f5837dbc7bf9a3af6ba Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Sun, 8 Jun 2025 12:43:07 -0700 Subject: [PATCH] call TryGetValue to get dictionary entry --- .../SymbolTree/RootSymbolTreeItemSourceProvider.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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.