Skip to content

Commit d92faae

Browse files
committed
Fix REPL execution bug in the LanguageServer
This change fixes a REPL execution bug in the LanguageServer which caused a NullReferenceException when the executed command failed due to an exception. The offending code was removed.
1 parent d8d908d commit d92faae

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -676,27 +676,17 @@ protected async Task HandleEvaluateRequest(
676676
DebugAdapterMessages.EvaluateRequestArguments evaluateParams,
677677
RequestContext<DebugAdapterMessages.EvaluateResponseBody> requestContext)
678678
{
679-
VariableDetails result =
680-
await editorSession.DebugService.EvaluateExpression(
681-
evaluateParams.Expression,
682-
evaluateParams.FrameId);
683-
684-
string valueString = null;
685-
int variableId = 0;
686-
687-
if (result != null)
688-
{
689-
valueString = result.ValueString;
690-
variableId =
691-
result.IsExpandable ?
692-
result.Id : 0;
693-
}
679+
var results =
680+
await this.editorSession.PowerShellContext.ExecuteScriptString(
681+
evaluateParams.Expression);
694682

683+
// Return an empty result since the result value is irrelevant
684+
// for this request in the LanguageServer
695685
await requestContext.SendResult(
696686
new DebugAdapterMessages.EvaluateResponseBody
697687
{
698-
Result = valueString,
699-
VariablesReference = variableId
688+
Result = "",
689+
VariablesReference = 0
700690
});
701691
}
702692

0 commit comments

Comments
 (0)