question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Visual Studio Code launch can't find custom prelaunch task

See original GitHub issue

Type: Bug

I’ve defined a task is tasks.json, in the .vscode folder, alongside the launch.json file. I added a reference to that task (using the task’s label) in the preLaunchTask attribute of the launch configuration, but when I execute that launch configuration VS Code says

[Window Title]
Visual Studio Code

[Content]
Could not find the specified task.
[ ] Remember my choice for this task  [Debug Anyway] [Configure Task] [Cancel]

If I click Configure Task, I can see the task listed in the drop-down menu. Is there any way to debug the “prelaunch process”? I able to run the task manually from the Terminal Run Task… menu and it works correctly. Happy to include the launch.json and tasks.json upon request.

I tried both in the most recent version of VS Code

Version: 1.70.1 (user setup)
Commit: 6d9b74a70ca9c7733b29f0456fd8195364076dda
Date: 2022-08-10T06:08:33.642Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Windows_NT x64 10.0.22000

and in the version I generated this bug from

VS Code version: Code - Insiders 1.71.0-insider (ef65ac1ba57f57f2a3961bfe94aa20481caca4c6, 2022-08-11T05:16:46.298Z) OS version: Windows_NT x64 10.0.22000 Modes: Sandboxed: Yes

System Info
Item Value
CPUs Intel® Core™ i9-10900K CPU @ 3.70GHz (20 x 3696)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 31.72GB (16.58GB free)
Process Argv
Screen Reader no
VM 0%
Extensions: none
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256198
vstes627:30244334
vslsvsres303:30308271
pythonvspyl392:30422396
pythontb:30258533
pythonvspyt551:30291412
pythonptprofiler:30281269
vshan820:30294714
pythondataviewer:30285072
vscod805:30301674
bridge0708:30335490
bridge0723:30353136
cmake_vspar411cf:30542925
vsaa593:30376534
pythonvs932:30404738
wslgetstarted:30449409
cppdebug:30492333
pylanb8912:30522163
vsclangdf:30492506
c4g48928:30535728
dsvsc012:30540252

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
iansul-mscommented, Sep 12, 2022

I decided to try to create a minimal repro, and in so doing I found that the problem seems to be that VS Code (intellisense?) suggests two things for prelaunchTask image And for some reason I chose to try {"task": "taskLabel", "type": "shell"} which doesn’t work, but prelaunchTask: "taskLabel" does work.

Docs for launch configuration do state this, implicitly… image My problem has been solved but I think the intellisense needs to be fixed (not sure where it comes from).

0reactions
meganroggecommented, Sep 12, 2022

Thanks for investigating and for the info. i’ll definitely fix that this iteration

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why can't vscode find `preLaunchTask`? - Stack Overflow
The custom tasks should be in a separate tasks.json file, not in the same launch.json file. From the docs on launch.json attributes:.
Read more >
Tasks in Visual Studio Code
Sometimes it is necessary to define your own custom tasks. Assume you have a script to run your tests in order to set...
Read more >
Customize build debug tasks with JSON files - Visual Studio ...
If the codebase uses custom build tools that Visual Studio doesn't recognize, you need to provide some configuration details to run and debug ......
Read more >
How to manually configure Visual Studio Code for Debugging ...
Next, Press Ctrl+Shift+P again and start typing “task” and choose Tasks: Configure Default Build Task from the list of suggestions, then choose Create...
Read more >
VS Code tips — Debug pre launch tasks - YouTube
Today's VS Code tip: debug pre launch tasksAdd a preLaunchTask to your debug configuration to automatically run a task when you start ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found