PowerShell / PowerShell/vscode-powershell
Conditional Breakpoint: Does Not Stop When Using A Private Variable
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 1.9k
- Fork
- 548
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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
- Launch VS Code with the PowerShell extension installed.
- 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."
}
}
-
Add a breakpoint to line 4.
-
Right-click on the breakpoint and click on "Edit Breakpoint..."
-
Enter the following expression.
$private:number -eq 100 -
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:".
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Chạy tập lệnh PowerShell đã được báo cáo trong VS Code với điểm ngắt có điều kiện trên dòng 4 bằng $private:number -eq 100, rồi so sánh với lần dừng dự kiến trước cảnh báo. Xem xét issue liên quan #5223 và theo dõi cách extension xử lý điều kiện điểm ngắt. Hoàn tất khi điểm ngắt được kích hoạt lúc biến private đạt 100.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- powershell, vscode
- Lĩnh vực
- developer-experience, tooling
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100