From 3e3922c5b95dd2edaf0ae45b35f7e987c0dfc507 Mon Sep 17 00:00:00 2001 From: Kevin Pilch-Bisson Date: Fri, 23 Sep 2016 14:21:04 -0700 Subject: [PATCH] Handle the solution not having a configuration. Fixes internal bug 268059. --- ...udioProjectTracker_IVsSolutionLoadEvents.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker_IVsSolutionLoadEvents.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker_IVsSolutionLoadEvents.cs index d12abd8e0f1..f02414f3873 100644 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker_IVsSolutionLoadEvents.cs +++ b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker_IVsSolutionLoadEvents.cs @@ -119,12 +119,20 @@ int IVsSolutionLoadEvents.OnAfterBackgroundSolutionLoadComplete() OutputToOutputWindow($"Getting project information - start"); var start = DateTimeOffset.UtcNow; - // Capture the context so that we come back on the UI thread, and do the actual project creation there. - var projectInfos = await deferredProjectWorkspaceService.GetDeferredProjectInfoForConfigurationAsync( - $"{solutionConfig.Name}|{solutionConfig.PlatformName}", - cancellationToken).ConfigureAwait(true); - AssertIsForeground(); + var projectInfos = SpecializedCollections.EmptyReadOnlyDictionary(); + + // Note that `solutionConfig` may be null. For example: if the solution doesn't actually + // contain any projects. + if (solutionConfig != null) + { + // Capture the context so that we come back on the UI thread, and do the actual project creation there. + projectInfos = await deferredProjectWorkspaceService.GetDeferredProjectInfoForConfigurationAsync( + $"{solutionConfig.Name}|{solutionConfig.PlatformName}", + cancellationToken).ConfigureAwait(true); + } + + AssertIsForeground(); cancellationToken.ThrowIfCancellationRequested(); OutputToOutputWindow($"Getting project information - done (took {DateTimeOffset.UtcNow - start})"); -- GitLab