Skip to content

Commit 17f3e8c

Browse files
Fix tests
1 parent 347f500 commit 17f3e8c

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/PowerShellEditorServices/Services/DebugAdapter/BreakpointService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public async Task<IReadOnlyList<Breakpoint>> GetBreakpointsAsync()
6262

6363
public async Task<IReadOnlyList<BreakpointDetails>> SetBreakpointsAsync(string escapedScriptPath, IReadOnlyList<BreakpointDetails> breakpoints)
6464
{
65-
if (_breakpointSyncService.IsSupported)
65+
if (_breakpointSyncService?.IsSupported is true)
6666
{
6767
// Since we're syncing breakpoints outside of debug configurations, if we can't find
6868
// an existing breakpoint then mark it as unverified.
@@ -249,7 +249,7 @@ public async Task RemoveAllBreakpointsAsync(string scriptPath = null)
249249
{
250250
// Only need to remove all breakpoints if we're not able to sync outside of debug
251251
// sessions.
252-
if (_breakpointSyncService.IsSupported)
252+
if (_breakpointSyncService?.IsSupported is true)
253253
{
254254
return;
255255
}

src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public PsesInternalHost(
240240
private bool ShouldExitExecutionLoop => _shouldExit || _shuttingDown != 0;
241241

242242
private BreakpointSyncService BreakpointSync
243-
=> _breakpointSyncService ??= _languageServer.GetService<BreakpointSyncService>();
243+
=> _breakpointSyncService ??= _languageServer?.GetService<BreakpointSyncService>();
244244

245245
public override void EnterNestedPrompt() => PushPowerShellAndRunLoop(
246246
CreateNestedPowerShell(CurrentRunspace),
@@ -894,7 +894,7 @@ private void PopPowerShell(RunspaceChangeAction runspaceChangeAction = RunspaceC
894894
newRunspaceFrame.RunspaceInfo));
895895
}
896896

897-
if (BreakpointSync.IsSupported)
897+
if (BreakpointSync?.IsSupported is true)
898898
{
899899
BreakpointSync.SyncServerAfterRunspacePop();
900900
}

test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ public DebugServiceTests()
5353
psesHost.DebugContext.EnableDebugMode();
5454
psesHost._readLineProvider.ReadLine = testReadLine;
5555

56+
DebugStateService debugStateService = new();
5657
breakpointService = new BreakpointService(
5758
NullLoggerFactory.Instance,
5859
psesHost,
5960
psesHost,
60-
new DebugStateService());
61+
debugStateService,
62+
breakpointSyncService: null);
6163

6264
debugService = new DebugService(
6365
psesHost,

0 commit comments

Comments
 (0)