VScode 调试模式显示 "Could not find the specified task"

VScode debug mode shows "Could not find the specified task"

当尝试在 vscode 中启动调试会话时,它会抛出有关未找到指定任务的错误。 我已经尝试过 this 等其他 SO 问题的解决方案,但没有成功。

launch.json:

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
    {
      ...
    },
    {
        "name": "MSEventHubs_Audit",
        "type": "python",
        "request": "launch",
        "program": "${workspaceFolder}/audit-events.py",
        "console": "integratedTerminal",
        "args": [
            "config/config.ini",
        ],
        "envFile": "${workspaceFolder}/.env",
        "env": {"PYTHONPATH": "${workspaceRoot}"},
        "justMyCode": false,
        "preLaunchTask": {
            "task": "audit_tunnel"
        }
    },
    {
     ...
    },
]
}

tasks.json:

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"command": "",
"args": [],
"tasks": [
    {
        "label": "activate_key",
        "type": "shell",
        "command": "smartOS_card_pin.sh",
        "args": [
            "${inputs:cardos_pass}"
        ],
        "group": "build",
    },
    {
        "label": "audit_tunnel",
        "type": "shell",
        "group": "build",
        "command": "ssh",
        "args": [
            "-NL",
            "port1:127.0.0.1:port2",
            "my_host"
        ],
        "dependsOn": "activate_key"
    },
    {
      ...
    }
],
"inputs": [
    {
    "id": "cardos_pass",
    "type": "promptString",
    "password": true
    }
]
}

我已经看了一段时间了,无法弄清楚我做错了什么。 vscode 知道我的任务的证据是出现弹出消息时

我点击 'Configure Task','audit_tunnel' 作为编辑选项出现。

我错过了什么?

变化:

"preLaunchTask": {
            "task": "audit_tunnel"
        }

收件人:

"preLaunchTask": "audit_tunnel"