microsoft / microsoft/vscode-python-debugger

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

Aperta
#1,095 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

triage-needed
Lingua principale
TypeScript
Stelle
181
Fork
126
Merge medio
2g 3h
PR unite (30g)
3

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Parti dal loader di process-picker che costruisce il percorso @vscode/windows-process-tree e segui il modo in cui il suo catch ampio seleziona WMIC. Riproduci la struttura pacchettizzata con node_modules.asar e node_modules.asar.unpacked, quindi verifica che l’enumerazione dei processi funzioni senza WMIC e che gli errori di caricamento rimangano visibili nell’extension host log.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
node.js, typescript
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
58/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.