diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs index 82afc2c53d20d..00e5b45ab13bb 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs @@ -8,6 +8,7 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Features.Workspaces; using Microsoft.CodeAnalysis.Text; using Microsoft.CommonLanguageServerProtocol.Framework; @@ -280,9 +281,11 @@ public static async Task CreateAsync( (workspace, solution) = await lspWorkspaceManager.GetLspSolutionInfoAsync(cancellationToken).ConfigureAwait(false); } - if (workspace is null) + if (workspace is null || solution is null) { - logger.LogError($"Could not find appropriate workspace for operation {workspace} on {method}"); + logger.LogError($"Could not find appropriate workspace or solution on {method}"); + FatalError.ReportWithDumpAndCatch(new Exception( + $"Could not find appropriate workspace or solution on {method}"), ErrorSeverity.Critical); } context = new RequestContext(