You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By contrast, with a thread job, that doesn't work: the thread job runs to completion, irrespective of the break point; the same applies to ForEach-Object -AsJob -Parallel.
Write-Verbose-Verbose 'Creating a job that uses `Set-PSBreakpoint -Command foo`'# NOTE: If you substitute `Start-Job` on the next line, the behavior is as expected.$job=Start-ThreadJob {
functionfoo {
'hi'
}
Set-PSBreakpoint-Command foo
foo
}
Write-Verbose-Verbose 'Waiting an arbitrary amount of time (e.g., 3 seconds)...'Start-Sleep3Write-Verbose-Verbose 'Initiating debugging...'$job|Debug-Job# Clean up.$job|Remove-Job-Force
Expected behavior
Hit Command breakpoint on 'foo'At line:3 char:16+ function foo {+
That is, the break point should be honored, irrespective of when Debug-Job is invoked,
and the debugger should be entered.
This is indeed how it works with a Start-Job (child process-based) job.
Actual behavior
Debug-Job: /path/to/some.ps1:42Line | 19 | $job | Debug-Job | ~~~~~~~~~ | The provided job and all child jobs were examined but no jobs were found that could be debugged. In order to debug a job or child job the job must support debugging and | also be in a running state.
That is, the thread job ran to completion without honoring the break point, and the attempt to call Debug-Job came too late.
Error details
No response
Environment data
PowerShell 7.5.0-preview.3
Version
2.0.3, as shipped with PowerShell Core v7.5.0-preview.3
Visuals
No response
The text was updated successfully, but these errors were encountered:
Prerequisites
Steps to reproduce
When using
Set-PSBreakpoint -Command
from a background (child process-based) job, theSet-PSBreakpoint -Command
is honored (assuming that the job is already in theRunning
state - see Background jobs (Start-Job
) andForEach-Object -AsJob -Parallel
, in combination withDebug-Job
, prematurely report being in theRunning
state, before being ready for debugging PowerShell#21258): the breakpoint suspends execution until theDebug-Job
call connects.By contrast, with a thread job, that doesn't work: the thread job runs to completion, irrespective of the break point; the same applies to
ForEach-Object -AsJob -Parallel
.Expected behavior
That is, the break point should be honored, irrespective of when
Debug-Job
is invoked,and the debugger should be entered.
This is indeed how it works with a
Start-Job
(child process-based) job.Actual behavior
That is, the thread job ran to completion without honoring the break point, and the attempt to call
Debug-Job
came too late.Error details
No response
Environment data
Version
2.0.3, as shipped with PowerShell Core v7.5.0-preview.3
Visuals
No response
The text was updated successfully, but these errors were encountered: