Unlike `Start-Job`, `Start-ThreadJob` doesn't respect a `Set-PSBreakpoint -Command` call in connection with `Debug-Job`
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 38/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- powershell
- 領域
- backend
研究方向
Start with the Start-ThreadJob reproduction and compare its breakpoint behavior with Start-Job and ForEach-Object -AsJob -Parallel. Read the thread job debugging and job state handling entry points, then trace why the breakpoint does not keep the thread job running for Debug-Job. Done means the reproduction enters the debugger at foo as expected.
由索引模型根據 Issue 內容生成。
描述
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Steps to reproduce
-
When using
Set-PSBreakpoint -Commandfrom a background (child process-based) job, theSet-PSBreakpoint -Commandis honored (assuming that the job is already in theRunningstate - see https://github.com/PowerShell/PowerShell/issues/21258): the breakpoint suspends execution until theDebug-Jobcall 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.
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 {
function foo {
'hi'
}
Set-PSBreakpoint -Command foo
foo
}
Write-Verbose -Verbose 'Waiting an arbitrary amount of time (e.g., 3 seconds)...'
Start-Sleep 3
Write-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:42
Line |
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
- 主要語言
- PowerShell
- 星號
- 37
- 分支
- 22
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
PowerShell/ThreadJob 的其他 Issue
-
難度 4/5 3-5 天 新手友好度 48/100
PowerShell/ThreadJob#59 · 1 個 reaction ·
-
enhancement
難度 3/5 1-2 天 新手友好度 56/100
PowerShell/ThreadJob#56 · 1 個 reaction ·
-
Set alias for ThreadJob command(s)可能已有人在做 @kilasuit 於 81 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 20/100
PowerShell/ThreadJob#45 · 1 則留言 ·
-
難度 1/5 1-3 小時 新手友好度 48/100
PowerShell/ThreadJob#44 ·
-
難度 4/5 3-5 天 新手友好度 35/100
PowerShell/ThreadJob#43 ·
查看 PowerShell/ThreadJob 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
-
bug P1
難度 2/5 1-3 小時 新手友好度 76/100
Toloka/tolokaforge#1947 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 83/100
-
area:io kernel-paused needs-triage
難度 2/5 1-3 小時 新手友好度 72/100
bherbruck/solvecraft#7854 ·
-
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆