Repository: vscode
Issue: Debug attach - launch.json pickProcess command launches before preLaunchTask
Labels: feature-request,debug

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes/No

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 1.72.0
- OS Version: Windows_NT x64 10.0.19044


Steps to Reproduce:

1. Define a debug attach type with command pickProcess.
2. Create a task example
3. Specify as preLaunch the task example created.
4. Run 

I have tested also with VS Code Insiders & C++ tool pre-release. 

Examples:
**Task definition**
```json
  {
        "label": "Deployment-tools-start-simulators",
        "isBackground": false,
        "type": "shell",
        "command": "${workspaceFolder}/rig_common/deployment_tools/build/sim/default_rig/start.sh",
        "options": {
          "cwd": "${workspaceFolder}/rig_common/deployment_tools/build/sim/default_rig",
          "env": {
            "DISPLAY": "${env:DISPLAY}",
            "USE_GUI": "${input:useGui}",
            "USE_HTML": "0",
            "USE_VNC": "0",
          }
        }, 
        "problemMatcher": [],
```
**Launch definition**
  //Start simulators, pick & attach to ioSim, stop after debug ends.
```json
        {
            "name": "(gdb) Start simulators & Attach Process to AcdsIoSim",
            "type": "cppdbg",
            "request": "attach",
            "program": "${workspaceFolder}/build/sim/default/AcdsIoSim.bin",
            "processId": "${command:pickProcess}",
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                },
            ],
            "preLaunchTask": "Deployment-tools-start-simulators",
            "postDebugTask": "Deployment-tools-stop-simulators",
        },
```
I have tried with a simple task like pip list
```json
 {
        "label": "pip list",
        "type": "shell",
        "command": "pip list",
        "problemMatcher": [{
          "pattern": [{
            "regexp": ".",
            "file": 1,"line": 1,
            "column": 1,"message": 1
          }],
         /* "background": {
              "activeOnStart": true,
              "beginsPattern": { "regexp": "." },
              "endsPattern": { "regexp": "." }
          },*/
        }]
      },
```

Same result.

I have seen different issues reporting this:

[debugger attach pickProcess should run after preLaunchTask #9773](https://github.com/microsoft/vscode-cpptools/issues/9773)
[Launch preLaunchTask should complete before resolveDebugConfiguration #95162](https://github.com/microsoft/vscode/issues/95162)

But none worked.
Could you give me a hand?

Thanks.