From 73070333674875dad510ff58e13b16cd0efe9f4e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 15 May 2024 16:08:00 -0700 Subject: [PATCH] Fix null initial name --- .../FindReferences/DependentProjectsFinder.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentProjectsFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentProjectsFinder.cs index 03b7590699e6c..dc87229e40fca 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentProjectsFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentProjectsFinder.cs @@ -375,6 +375,15 @@ private static async Task HasReferenceToAssemblyAsync(Project project, str using (await s_metadataIdToAssemblyNameGate.DisposableWaitAsync(cancellationToken).ConfigureAwait(false)) { + // Overwrite an existing null name with a non-null one. + if (s_metadataIdToAssemblyName.TryGetValue(metadataId, out var existingName) && + existingName == null && + name != null) + { + s_metadataIdToAssemblyName[metadataId] = name; + } + + // Return whatever is in the map, adding ourselves if something is not already there. name = s_metadataIdToAssemblyName.GetOrAdd(metadataId, name); }