From 9bd577ca43902648b74d9c4ca2882affa8b8ce1e Mon Sep 17 00:00:00 2001 From: akhera99 Date: Tue, 19 Dec 2023 15:41:13 -0800 Subject: [PATCH 1/4] add error logging --- .../LanguageServer/Protocol/Handler/RequestContext.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs index 82afc2c53d20d..1f3c605cacacb 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}"); + FatalError.ReportWithDumpAndCatch(new Exception( + $"Could not find appropriate workspace or solution for operation {workspace}, {solution} on {method}"), ErrorSeverity.General); } context = new RequestContext( From afd6d93d97deefcf15b00432fb5dd9cfe37e5579 Mon Sep 17 00:00:00 2001 From: akhera99 Date: Tue, 19 Dec 2023 16:05:54 -0800 Subject: [PATCH 2/4] feedback --- src/Features/LanguageServer/Protocol/Handler/RequestContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs index 1f3c605cacacb..d44ffe90e1e3a 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs @@ -285,7 +285,7 @@ public static async Task CreateAsync( { logger.LogError($"Could not find appropriate workspace for operation {workspace} on {method}"); FatalError.ReportWithDumpAndCatch(new Exception( - $"Could not find appropriate workspace or solution for operation {workspace}, {solution} on {method}"), ErrorSeverity.General); + $"Could not find appropriate workspace or solution on {method}"), ErrorSeverity.Critical); } context = new RequestContext( From c1c82854264f42b5d1522a0d01ecaab6ed1fa675 Mon Sep 17 00:00:00 2001 From: akhera99 Date: Tue, 19 Dec 2023 16:20:28 -0800 Subject: [PATCH 3/4] fix --- src/Features/LanguageServer/Protocol/Handler/RequestContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs index d44ffe90e1e3a..1a12123242cb2 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs @@ -283,7 +283,7 @@ public static async Task CreateAsync( 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 solution on {method}"); FatalError.ReportWithDumpAndCatch(new Exception( $"Could not find appropriate workspace or solution on {method}"), ErrorSeverity.Critical); } From c0d1a53dffa24de064e27a551ae0e2e18a2dafd4 Mon Sep 17 00:00:00 2001 From: Ankita Khera <40616383+akhera99@users.noreply.github.com> Date: Wed, 20 Dec 2023 15:44:42 -0800 Subject: [PATCH 4/4] Update src/Features/LanguageServer/Protocol/Handler/RequestContext.cs Co-authored-by: Jason Malinowski --- src/Features/LanguageServer/Protocol/Handler/RequestContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs index 1a12123242cb2..00e5b45ab13bb 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs @@ -283,7 +283,7 @@ public static async Task CreateAsync( if (workspace is null || solution is null) { - logger.LogError($"Could not find appropriate workspace solution 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); }