Skip to content

Commit a180e4c

Browse files
committed
Fix #357: Watch evaluation causes debugger hang
This issue is caused when VS Cod sends watch expression evaluation requests after the debugger has been resumed. This issue has been fixed in the most recent builds of VS Code but we must have a guard for this on our side for those who are still using VS Code Stable.
1 parent 3e785a1 commit a180e4c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -764,11 +764,17 @@ protected async Task HandleEvaluateRequest(
764764
}
765765
else
766766
{
767-
VariableDetails result =
768-
await editorSession.DebugService.EvaluateExpression(
769-
evaluateParams.Expression,
770-
evaluateParams.FrameId,
771-
isFromRepl);
767+
VariableDetails result = null;
768+
769+
// VS Code might send this request after the debugger
770+
// has been resumed, return an empty result in this case.
771+
if (editorSession.PowerShellContext.IsDebuggerStopped)
772+
{
773+
await editorSession.DebugService.EvaluateExpression(
774+
evaluateParams.Expression,
775+
evaluateParams.FrameId,
776+
isFromRepl);
777+
}
772778

773779
if (result != null)
774780
{

0 commit comments

Comments
 (0)