From 5e1baba735ee7b3afe0fbf3e30546e8e54b9a492 Mon Sep 17 00:00:00 2001 From: Kevin Pilch-Bisson Date: Wed, 29 Jun 2016 11:04:36 -0700 Subject: [PATCH] When unloading a head project, there may not be a context project --- .../ProjectSystem/VisualStudioWorkspaceImpl.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs index 178fb727559..bcba78cfac1 100644 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs +++ b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs @@ -877,10 +877,11 @@ internal void UpdateDocumentContextIfContainsDocument(IVsHierarchy sharedHierarc // find that one, we can map back to the open buffer and set its active context to // the appropriate project. + // Note that if there is a single head project and it's in the process of being unloaded + // there might not be a host project. var hostProject = LinkedFileUtilities.GetContextHostProject(sharedHierarchy, ProjectTracker); - if (hostProject.Hierarchy == sharedHierarchy) + if (hostProject?.Hierarchy == sharedHierarchy) { - // How? return; } -- GitLab