Issue Type: Bug
Hi!
I'm having issues with using the default 'PowerShell Attach to Host Process' configuration in order to debug a PS script that I have running in a separate PowerShell console window.
When I run the debug configuration, I get presented with a list of processes to attach to and when I'm selecting the one I need, I get the following error message:
'${command:PickPSHostProcess}' can not be resolved because the command has no value.

Am I doing something wrong? Is there anything else that I need to add to my configuration?
Please let me know if you need the logs, as I can reproduce it in a new VSCode session with a simple HelloWorld script.
Extension version: 1.7.0
VS Code version: Code 1.23.1 (d0182c3417d225529c6d5ad24b7572815d0de9ac, 2018-05-10T17:11:17.614Z)
OS version: Windows_NT x64 10.0.16299
System Info
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz (4 x 2496)|
|GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
video_decode: enabled
video_encode: enabled
vpx_decode: unavailable_software
webgl: enabled
webgl2: enabled|
|Memory (System)|7.88GB (0.51GB free)|
|Process Argv|C:\Program Files\Microsoft VS Code\Code.exe|
|Screen Reader|no|
|VM|0%|
I can repro this. I'll take a look at it tonight.
Same for me
I think I have a fix for this but what's weird is that I'm only seeing this in the VSCode Insiders build. Would you mind performing a quick hack to see if my proposed fix fixes the issue for stable VSCode release?
If so, open up the file ~\.vscode\extensions\ms-vscode.powershell-1.7.0\out\src\features\DebugSession.js in an editor and change line 258 from this:
return item ? item.pid : "";
to this:
return item ? `${item.pid}` : "";
Let me know if that fixes the issue you are seeing (or not).
@rkeithhill, that did the trick. Thanks a ton!
Excellent! Thanks for trying that out.
@isidorn @weinand Turns out we have a similar issue with the process picker for our debugger's "attach to PS host process". I have fixed it to return a string rather than a number but I'm not sure what to return when the press Esc to cancel the debug session. If I return "" then for some reason the launch.json file is opened and the cursor is placed on the line where the specifyProcessId command is. That doesn't seem like a great user experience so I've experimented with returning undefined and that seems to work the way I want. I noticed that the C# debugger also works this way when you escape from the process picker. However they use null:
Actually, perhaps it is this line that is what we should mimic:
What do you recommend that we return for this case?
@rkeithhill sorry I was on vacation for the previous 10 days, do you still need suggestions here?
I went with returning undefined when the intent is to cancel debugger activation. If that's problematic, let me know.
@rkeithhill that is not problemtic and something that the dart debugger already does afaik
@isidorn Thanks!