Skip to content

dependsOn executes wrong tasks in multi-root workspaces #144761

@dedChar

Description

@dedChar

Issue Type: Bug

Running tasks with dependencies in a multi-root workspace executes the wrong dependency tasks, if there are multiple tasks defined under the same label but in different root folders. VSCode will just pick the first occurance in the order of the root folders defined in the workspace settings.

To reproduce the issue:

  1. Setup a simple multi-root workspace, e.g.
{
	"folders": [
		{
			"path": "root1"
		},
		{
			"path": "root2"
		},
		{
			"path": "root3"
		}
	],
	"settings": {}
}
  1. In each root folder, add a tasks.json with two tasks. One task depends on the other. Example tasks of root1:
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "dependency",
            "type": "shell",
            "command": "echo 'This is the dependency task of root1'"
        },
        {
            "label": "main",
            "type": "shell",
            "dependsOn": ["dependency"],
            "command": "echo 'And this is the main task of root1'"
        }
    ]
}

root2 and root3 have the same tasks configured except that they echo their respective folder name instead.

  1. Run task main of either root2 or root3.

Expected output for main of root2

> Executing task in folder root2: echo 'This is the dependency task of root2' <

This is the dependency task of root2

Terminal will be reused by tasks, press any key to close it.

> Executing task in folder root2: echo 'And this is the main task of root2' <

And this is the main task of root2

Terminal will be reused by tasks, press any key to close it.

Actual output on 1.65.1

> Executing task in folder root1: echo 'This is the dependency task of root1' <

This is the dependency task of root1

Terminal will be reused by tasks, press any key to close it.

> Executing task in folder root2: echo 'And this is the main task of root2' <

And this is the main task of root2

Terminal will be reused by tasks, press any key to close it.

VS Code version: Code 1.65.1 (8908a9c, 2022-03-08T02:06:27.846Z)
OS version: Windows_NT x64 10.0.19042
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 x 3408)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.89GB (5.94GB free)
Process Argv --crash-reporter-id d9b02cb9-bd4f-4c77-be31-8b430da86809
Screen Reader no
VM 0%
Extensions: none
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30443607
pythontb:30283811
pythonvspyt551:30345470
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscorecescf:30445987
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vsclayoutctrc:30448490
dsvsc009:30440023
pythonvspyt640:30450168
vsbas813:30436447
vscscmwlcmc:30438804
vscgsvidc:30447482
helix:30440343
pynewfile477:30450038

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugcandidateIssue identified as probable candidate for fixing in the next releasetasksTask system issuesverifiedVerification succeeded

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions