Skip to content

An error occurs when I try to attach to a Host Process #1322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Glober777 opened this issue May 17, 2018 · 10 comments · Fixed by #1323
Closed

An error occurs when I try to attach to a Host Process #1322

Glober777 opened this issue May 17, 2018 · 10 comments · Fixed by #1323
Assignees
Labels

Comments

@Glober777
Copy link

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.

image

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%
@rkeithhill
Copy link
Contributor

I can repro this. I'll take a look at it tonight.

@jwmarrott
Copy link

Same for me

@rkeithhill
Copy link
Contributor

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).

@Glober777
Copy link
Author

@rkeithhill, that did the trick. Thanks a ton!

@rkeithhill
Copy link
Contributor

Excellent! Thanks for trying that out.

@rkeithhill
Copy link
Contributor

rkeithhill commented May 18, 2018

@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:

https://github.com/OmniSharp/omnisharp-vscode/blob/c908660921a1c81f94c32ae2976cb3def7b1cc2e/src/features/processPicker.ts#L35-L38

Actually, perhaps it is this line that is what we should mimic:

https://github.com/OmniSharp/omnisharp-vscode/blob/c908660921a1c81f94c32ae2976cb3def7b1cc2e/src/features/processPicker.ts#L232

What do you recommend that we return for this case?

@isidorn
Copy link
Contributor

isidorn commented May 28, 2018

@rkeithhill sorry I was on vacation for the previous 10 days, do you still need suggestions here?

@rkeithhill
Copy link
Contributor

I went with returning undefined when the intent is to cancel debugger activation. If that's problematic, let me know.

@isidorn
Copy link
Contributor

isidorn commented May 29, 2018

@rkeithhill that is not problemtic and something that the dart debugger already does afaik

@rkeithhill
Copy link
Contributor

@isidorn Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants