Skip to content

Commit d29dc6d

Browse files
committed
Set ServerStarted with TrySetResult since unit tests might do it twice
1 parent 65456bd commit d29dc6d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/PowerShellEditorServices/Services/DebugAdapter/DebugEventHandlerService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private void OnRunspaceChanged(object sender, RunspaceChangedEventArgs e)
101101
// Sends the InitializedEvent so that the debugger will continue
102102
// sending configuration requests
103103
_debugStateService.WaitingForAttach = false;
104-
_debugStateService.ServerStarted.SetResult(true);
104+
_debugStateService.ServerStarted.TrySetResult(true);
105105
}
106106
return;
107107

src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public async Task<LaunchResponse> Handle(PsesLaunchRequestArguments request, Can
210210

211211
// Sends the InitializedEvent so that the debugger will continue
212212
// sending configuration requests
213-
_debugStateService.ServerStarted.SetResult(true);
213+
_debugStateService.ServerStarted.TrySetResult(true);
214214

215215
return new LaunchResponse();
216216
}
@@ -440,7 +440,7 @@ await _executionService.ExecutePSCommandAsync(
440440

441441
if (runspaceVersion.Version.Major >= 7)
442442
{
443-
_debugStateService.ServerStarted.SetResult(true);
443+
_debugStateService.ServerStarted.TrySetResult(true);
444444
}
445445
return new AttachResponse();
446446
}

0 commit comments

Comments
 (0)