microsoft / microsoft/vscode-cpptools
Debugger launched executable seems not able to access wsl command
Open
Nobody has claimed this yet.
debugger
help wanted
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Environment
- OS and version: Windows 11
- VS Code: 1.100.2
- C/C++ extension: ms-vscode.cpptools@1.25.3
- OS and version of remote machine (if applicable):
- GDB / LLDB version: GNU gdb (GDB) 16.2
Bug Summary and Steps to Reproduce
Bug Summary:
The program launched by debugger seems not able to use wsl.
Same as #13110, manually executing the program in the same/other integrated terminal works, external works.
Access is denied.
Error code: Wsl/Service/E_ACCESSDENIED
Steps to reproduce:
- Open a folder
- Create code:
- F5 choose detected task "C/C++: g++.exe build active file", auto-generated a tasks.json under ./.vscode
- Open redirected outputs
Code:
#include <bits/stdc++.h>
using namespace std;
void closePipe(FILE *pipe)
{
if (pipe)
{
pclose(pipe);
}
}
int main(int argc, char *args[])
{
auto pipe = popen("wsl --shell-type none -- ls . 1>pipe1 2>&1", "r");
closePipe(pipe);
auto pipe2 = popen("wsl --shell-type none -- ls . 1>pipe2 2>&1", "r");
closePipe(pipe2);
auto pipe3 = popen("dir . 1>pipe3 2>&1", "r");
closePipe(pipe3);
return 0;
}
Debugger Configurations
tasks.json
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "D:\\Build_Tool_Lib\\x86_64-15.1.0-release-win32-seh-msvcrt-rt_v12-rev0\\mingw64\\bin\\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/${fileBasenameNoExtension}",
"externalConsole": false,
"cwd": "${fileDirname}",
"MIMode": "gdb",
"miDebuggerPath": "D:\\Build_Tool_Lib\\x86_64-15.1.0-release-win32-seh-msvcrt-rt_v12-rev0\\mingw64\\bin\\gdb.exe",
"logging": {
"engineLogging": true,
"trace": true,
"traceResponse": true
}
}
]
}
Debugger Logs
C/C++ outputs:
Launch configuration:
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "C:\\Users\\rabbit\\Desktop\\CPPTools/Hello",
"externalConsole": false,
"cwd": "C:\\Users\\rabbit\\Desktop\\CPPTools",
"MIMode": "gdb",
"miDebuggerPath": "D:\\Build_Tool_Lib\\x86_64-15.1.0-release-win32-seh-msvcrt-rt_v12-rev0\\mingw64\\bin\\gdb.exe",
"logging": {
"engineLogging": true,
"trace": true,
"traceResponse": true
},
"__configurationTarget": 6
}
Other Extensions
No response
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure using the generated .vscode/tasks.json and launch.json, then read the linked debugger console logs and compare the behavior with issue #13110. Done means the debugger-launched executable can run the reported wsl command without E_ACCESSDENIED, while the existing terminal behavior remains unaffected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, vscode
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100