Skip to content

launch.json: "${command:pickProcess}" prompts for a process to attach to *before* running pre-launch tasks #75604

@mklement0

Description

@mklement0

As of VSCode v1.35.1, a launch configuration defined in launch.json that uses "${command:pickProcess}" as its "processId" value - in order to prompt for a process to attach to - does so before running any pre-launch tasks (preLaunchTask property).

  • Is this by design?
  • Is there a way to reverse this order?

The reason I want my prelaunch task to run first is twofold:

  • generally, since my prelaunch task includes building, I want the launch to be aborted if building fails.

  • specifically, my prelaunch task creates the process that I then want to attach to.

Taking a step back, my ideal solution would be to have the prelaunch task not only create the process to attach to, but to have the launch configuration automatically attach to it afterwards, but I haven't found a way to do that, given that:

  • starting the debugger from the command line isn't supported yet - though support is being considered - see Suggestion: Start VSCode debugger from the command-line #10979

  • there seems to be no way to populate a launch-configuration property from an arbitrary shell command (you can only call VSCode-internal commands via ${command:...}).

Note: I hit this limitation when trying to debug binary PowerShell modules via an external PowerShell console. I've since realized that the C# debugger automatically attaches to any external process created via a "request": "launch" launch configuration, so launching a PowerShell console that way (with a startup command that imports the binary module) is sufficient.

Metadata

Metadata

Assignees

Labels

*as-designedDescribed behavior is as designeddebugDebug viewlet, configurations, breakpoints, adapter issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions