microsoft / microsoft/vscode-cpptools
VSCode Debugger Environment Variable Case Sensitivity Causes DLL Loading Issues
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Type: Bug
Description:
On Windows, VSCode's launch.json configuration file treats environment variables Path and PATH as case-sensitive. However, Windows itself does not distinguish between Path and PATH, and only recognizes Path for DLL loading. If PATH is incorrectly used in launch.json, the program may fail to load DLL files during debugging.
Steps to Reproduce:
Create a simple program that requires a DLL file to be loaded.
In launch.json, incorrectly configure the environment variable as PATH instead of Path (e.g., "name": "PATH", "value": "C:\path\to\dlls").
When debugging, the program will fail to load the DLL, showing an error.
Changing PATH to Path in launch.json resolves the issue and allows the DLL to be loaded.
Actual Behavior:
Using PATH does not affect DLL loading in Windows, causing DLLs to not be found during debugging.
Expected Behavior:
VSCode should handle environment variables uniformly and not differentiate between Path and PATH, ensuring that DLLs can be loaded successfully during debugging.
Suggested Solution:
Fix the issue in VSCode where environment variables are treated case-sensitively in launch.json. Ensure that both Path and PATH are treated identically to avoid DLL loading issues.
To verify this process is quite simple with the following configuration in launch.json:
{
"configurations": [
{
"name": "C/C++ gdb",
"type": "cppdbg",
"request": "launch",
// other
"environment": [
{
"name": "Path",
"value": "c:\xb"
}
]
}
]
}
In the environment variable settings, the value of "name" is case-sensitive. When it is "Path" instead of "PATH" or "PAth," it represents two distinct environment variables. You can create a C program to retrieve this variable for verification, such as using printf(getenv("path")) to display the variable's value. If the name is "Path" instead of "PATH," the output will show the difference between the two environment variables. The getenv function is also case-sensitive in order to obtain the correct value.
However, it appears that in typical scenarios, using system APIs to set the PATH environment variable or using batch commands like set path does not differentiate between uppercase and lowercase. This case sensitivity seems to occur only in the configuration of Visual Studio Code.
Extension version: 1.23.6
VS Code version: Code 1.97.2 (e54c774e0add60467559eb0d1e229c6452cf8447, 2025-02-12T23:20:35.343Z)
OS version: Windows_NT x64 10.0.19045
Modes:
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 3 3200G with Radeon Vega Graphics (4 x 3593) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: enabled_on 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_graphite: disabled_off video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 15.95GB (8.75GB free) |
| Process Argv | --crash-reporter-id b3bb9a5d-7db1-4dd9-95fc-227712ac9688 |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vscod805:30301674
binariesv615:30325510
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dwnewjupyter:31046869
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc2:31192216
iacca1:31171482
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31222730
jda6j935:31233686
copilothoveroff:31248523
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
Start by reproducing the Windows debugging case using the launch.json environment configuration and the C/C++ extension version reported here. Trace how the environment name is processed during launch, then verify that casing variations for Path produce the expected DLL-loading behavior. Confirm the result with the same configuration and a program requiring a DLL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, typescript, 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