vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Button "Run C/C++ File" or "Debug C/C++ File" starts wrong task (not configured)

Open skarasov opened this issue 3 years ago • 2 comments

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.). run

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

skarasov avatar Jul 19 '22 13:07 skarasov

@elahehrashedi Do you understand this issue?

sean-mcmanus avatar Jul 19 '22 20:07 sean-mcmanus

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).

u

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",
		}
	]
}

skarasov avatar Jul 28 '22 15:07 skarasov

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.

Mase3206 avatar Jan 29 '24 02:01 Mase3206