microsoft / microsoft/vscode-cpptools

MSVC Debug error: Windows cannot find 'C:\Program'. Make sure you typed the name correctly, and then try again

Open
#10,946 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug debugger
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and version: Windows 10 21H2
  • VS Code: 1.78.2
  • C/C++ extension: 1.15.4
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version: MSVC 2022,2019,2017,...2005 All versions installed on dev station.
Bug Summary and Steps to Reproduce

Bug Summary:
Debugger fails to start on Windows with Visual studio 2005-2022

Steps to reproduce:
follow the procedure from https://code.visualstudio.com/docs/cpp/config-msvc
at the step where the debug is excepted to launch in debug, it will pop an error window with,
Logo X in red circle
Title: C:\Program
Message: Windows cannot find 'C:\Program'. Make sure you typed the name correctly, and then try again
Buttons: Ok

Debugger Configurations
task.json:
{
  "tasks": [
    {
      "type": "cppbuild",
      "label": "C/C++: cl.exe build active file",
      "command": "cl.exe",
      "args": [
        "/Zi",
        "/EHsc",
        "/nologo",
        "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe",
        "${file}"
      ],
      "options": {
        "cwd": "${fileDirname}"
      },
      "problemMatcher": [
        "$msCompile"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "detail": "Task generated by Debugger."
    }
  ],
  "version": "2.0.0"
}
launch.json
{
    // 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",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "${workspaceFolder}/helloworld.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "console": "externalTerminal"
        }

    ]
}
Debugger Logs
No logs generated
Other Extensions

No response

Additional Information

This issue started at version 1.2.0, if I rollback to version 1.1.3, the debugger works as expected with msvc when starting from the vscode from the corresponding developer command prompt for VSXXXX

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the task.json and launch.json configurations shown in the report, then reproduce the failure by following the linked MSVC setup procedure from the appropriate Visual Studio developer command prompt. Compare behavior between extension versions 1.2.0 and 1.1.3; done means the debugger launches without the Windows C:\Program error using the reported MSVC configurations.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.