PowerShell / PowerShell/vscode-powershell

Conditional Breakpoint: Does Not Stop When Using A Private Variable

オープン
#5,301 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Issue-Bug Needs: Triage
主要言語
TypeScript
スター
1.9k
フォーク
548
PR マージ指標
30日以内にマージされた PR はありません

説明

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.
Summary

When the condition in a conditional breakpoint contains a reference to a private variable defined by the script, the breakpoint is not activated.

PowerShell Version
Name                           Value
----                           -----
PSVersion                      7.4.12
PSEdition                      Core
GitCommitId                    7.4.12
OS                             Microsoft Windows 10.0.20348
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0.}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Visual Studio Code Version
1.105.1
x64
Extension Version
ms-vscode.powershell@2025.4.0
Steps to Reproduce
  1. Launch VS Code with the PowerShell extension installed.
  2. Paste the following code into a new window.
$numbers = 1..100

foreach ($private:number in $numbers) {
    write-host $private:number
    if ($private:number -eq 100) {
        write-warning "The breakpoint should trip before this line of code."
    }
}
  1. Add a breakpoint to line 4.

  2. Right-click on the breakpoint and click on "Edit Breakpoint..."

  3. Enter the following expression.
    $private:number -eq 100

  4. Run the script.

Visuals

No response

Logs

After setting the log level to Trace, I restarted VS Code and reproduced the issue. Afterwards, none of the folders in "%APPDATA%\Code\User\globalStorage\ms-vscode.powershell\logs" appeared to have been modified today.

This issue might be related to https://github.com/PowerShell/vscode-powershell/issues/5223. But that one uses "$_" instead of "$private:".

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

報告された PowerShell スクリプトを VS Code で、4 行目に $private:number -eq 100 を使用した条件付きブレークポイントを設定して実行し、警告の前で停止するという期待される動作と比較します。関連する issue #5223 を確認し、拡張機能のブレークポイント条件処理を追跡します。プライベート変数が 100 に達したときにブレークポイントが有効になることが完了の条件です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
powershell, vscode
領域
developer-experience, tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。