Skip to content

Debug launching before preLaunchTask ready when dependsOn task defined #54397

@halovanic

Description

@halovanic
  • VSCode Version: 1.26.0-insider (and 1.25.1)
  • Commit: 6babef9
  • OS Version: Win10 x64

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Define a launch configuration with a preLaunchTask.
  2. Define that preLaunchTask as a background task with a (non-background) dependsOn task to execute before it.
  3. Debug with the launch configuration. The launch/debugger opens at what appears to be the completion of the dependsOn task, rather than when expected at the endsPattern of the preLaunchTask. It is not immediate, but it is far too early.

Taking out the dependsOn task from the preLaunchTask definition results in the expected behavior: the debugger waits to launch at the point that the preLaunchTask prints a message matching the endsPattern.

Also, making the preLaunchTask a non-background task seems to have the expected behavior: the dependsOn task executes before the preLaunchTask before the launch configuration.

There is no difficulty outside of the launch: the tasks defined execute in the expected sequence and match problems whether they were started directly, or via the launch. It's just that the debugger starts too early under these circumstances. It also does not seem to be specific to any one launch extension.

Thanks,
Alex

launch.json:

{
"version": "0.2.0",
"configurations": [
    {
        "type": "chrome",
        "request": "launch",
        "name": "Debug in Chrome",
        "url": "https://localhost:3801",
        "webRoot": "${workspaceFolder}",
        "preLaunchTask": "Build and Watch",
    }
]
}

tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Install Packages",
            "type": "shell",
            "command": "yarn",
            "group": "build"
        },
        {
            "label": "Build and Watch",
            "dependsOn": "Install Packages",
            "type": "shell",
            "command": "yarn",
            "args": [
                "watch"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": [
                {
                    "owner": "javascript",
                    "fileLocation": [
                        "relative",
                        "${workspaceFolder}"
                    ],
                    "pattern": [
                        {
                            "regexp": "(ERROR|WARNING) in (.*\\.js)",
                            "severity": 1,
                            "file": 2,
                        },
                        {
                            "regexp": "^.*$",
                        },
                        {
                            "regexp": "(.*)\\s\\((\\d+):(\\d+)\\)",
                            "message": 1,
                            "line": 2,
                            "column": 3
                        }
                    ],
                    "background": {
                        /* Problems are printed after this message. */
                        "beginsPattern": "Build Finished",
                        /* Matching Browsersync messaging. */
                        "endsPattern": "\\[TOOLKIT\\]",
                        "activeOnStart": true
                    }
                }
            ],
            "isBackground": true,
        }
    ]
}

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugverifiedVerification succeeded

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions