vscode-cpptools
vscode-cpptools copied to clipboard
Button "Run C/C++ File" or "Debug C/C++ File" starts wrong task (not configured)
Issue Type: Bug
Create simple C code. Create/configure task.json and launch.json.
Press button "Run C/C++ File" (1.). Starts wrong configuration (3.), but not configured one (4. 5.).

Pressing F5, Ctrl-F5 - works well.
Extension version: 1.10.8 VS Code version: Code 1.69.2 (3b889b090b5ad5793f524b5d1d39fda662b96a2a, 2022-07-18T16:12:52.460Z) OS version: Windows_NT x64 10.0.19044 Restricted Mode: No
@elahehrashedi Do you understand this issue?
Please, fix work logic of button "Debug C/C++ File"!
Create simple c project, create launch.json, press "Debug C/C++ File" button - it starts not configured task (launch.json) but first task in the list (which you can see if press gear button).

In addition: my launch.json have an error (wrong program = a.exe). F5 - shows an error, but "Run C/C++ File" starts prelaunchtask and run it.
{
// 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": "(Windows) Launch My",
"type": "cppvsdbg",
"request": "launch",
"program": "a.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"console": "externalTerminal",
}
]
}
This is endlessly confusing. I would expect the "Run C/C++ file" button to build and then run said file, but it instead loads the debug config without debugging it. When using the tasks.json configuration, I would expect running it normally (not debugging it) to use the "build" group and debugging it would use the "test" group (or maybe add another called "debug"). This should seriously be fixed.