microsoft / microsoft/vscode-python-debugger

Attach process picker still hangs without WMIC because windows-process-tree loader misses node_modules.asar

Đang mở
#1,095 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

triage-needed
Ngôn ngữ chính
TypeScript
Star
181
Fork
126
Merge trung bình
2 ngày 3 giờ
Pull request đã merge (30 ngày)
3

Mô tả

Environment

  • Python Debugger: 2026.7.12401012 (pre-release)
  • VS Code: 1.135.0 (08d4889f9ec4a1685d257b9b95de036c8e1ce1e5, x64)
  • OS: Windows 11 Pro x64, 10.0.26200
  • WMIC: not installed

Reproduction

Use the generated attach configuration:

{
    "name": "Python Debugger: Attach using Process Id",
    "type": "debugpy",
    "request": "attach",
    "processId": "${command:pickProcess}"
}

Start debugging and wait for the process picker.

Expected behavior

A Quick Pick containing the running processes is displayed.

Actual behavior

The progress indicator keeps running, but the process picker never appears. The extension host log contains:

Error: spawn wmic ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:287:19)
    at onErrorNT (node:internal/child_process:508:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)

Using a literal PID works.

Cause found locally

The current implementation added in #1030 loads the native module from this path:

const wpcPath = path.join(env.appRoot, 'node_modules', '@vscode', 'windows-process-tree');
const nodeRequire = eval('require') as NodeJS.Require;
return nodeRequire(wpcPath);

In the packaged VS Code 1.135.0 installation, @vscode/windows-process-tree is not present under the physical node_modules directory. It is packaged at:

<env.appRoot>/node_modules.asar/@vscode/windows-process-tree

with its native files under node_modules.asar.unpacked.

Loading both paths with VS Code's Electron/Node runtime produces:

<env.appRoot>/node_modules/@vscode/windows-process-tree
  -> MODULE_NOT_FOUND

<env.appRoot>/node_modules.asar/@vscode/windows-process-tree
  -> loads successfully
  -> exports ProcessDataFlag, getAllProcesses, getProcessList, etc.

The native loader exception is swallowed by the broad catch, so the provider silently falls back to WMIC. WMIC is no longer installed by default on current Windows builds, and that second failure leaves the picker waiting indefinitely.

Suggested direction

  • Resolve the packaged ASAR location as well as development/older layouts.
  • Avoid falling back exclusively to deprecated WMIC; PowerShell/CIM could provide a non-native fallback.
  • Log the original windows-process-tree loading exception so this failure mode is visible.

Related: #744, #867, #899, #991, #1030.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu từ process-picker loader tạo đường dẫn @vscode/windows-process-tree và theo dõi cách catch tổng quát của nó chọn WMIC. Tái tạo bố cục đã đóng gói với node_modules.asar và node_modules.asar.unpacked, sau đó xác minh rằng việc liệt kê tiến trình hoạt động mà không cần WMIC và các lỗi tải vẫn hiển thị trong extension host log.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
node.js, typescript
Lĩnh vực
devtools
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
58/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.