VS Code 1.88 inserts ^C before running a debug configuration again. Why?

Every time vscode runs C++ code, the terminal will enter a ^C instruction and an Enter operation before it starts.

PS D:DocumentsCodeSTL> ^C
PS D:DocumentsCodeSTL> 
PS D:DocumentsCodeSTL>  & 'c:Users27532.vscodeextensionsms-vscode.cpptools-1.19.9-win32-x64debugAdaptersbinWindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-ycqe3hxg.xjn' '--stdout=Microsoft-MIEngine-Out-c1vkgva4.men' '--stderr=Microsoft-MIEngine-Error-qsdbie2i.1u5' '--pid=Microsoft-MIEngine-Pid-wpjz1cze.2ye' '--dbgExe=d:DevEnvMSYS2ucrt64bingdb.exe' '--interpreter=mi'

I swear this action was not entered by me

I checked launch.json file contents and there was no problem

C/C++ extend is v1.19.9

  • launch.json
{
    "configurations": [
        {
            "name": "C/C++: g++.exe 生成和调试活动文件",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}\out\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "d:\DevEnv\MSYS2\ucrt64\bin",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "d:\DevEnv\MSYS2\ucrt64\bin\gdb.exe",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "将反汇编风格设置为 Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe 生成活动文件"
        }
    ],
    "version": "2.0.0"
}

0

Considering the timing of this question (posted right after the release of VS Code 1.88), this is likely the result of pull request debug: clear prompt if a terminal is reused betwen debug sessions #206632, which was made in response to issue ticket My project’s root directory got deleted during the execution of Python Debugging Session. #106743, and put in the March 2024 (1.88) release milestone.

I encourage you to read those linked resources to understand the context, but TL;DR is there was a paper-cut scenario (mixed with some rather bad luck) where debug configurations that reuse the terminal created for prior runs wouldn’t do anything to clear any non-executed/in-progress commandline if the user wrote something in the commandline for that terminal, but didn’t execute it, and then ran the same debug configuration again.

This change is supposed to tell the shell to abort editing the current command and start a new one (it seems to happen that most shells use ctrl+c / u0003 (ASCII end-of-text) for this).

At the time of this writing, there’s no way to configure whether or not VS Code does this.

If this actually causes issues for you, you should raise an issue ticket about it, making sure to explain what the issue is, and linking back to #206632 and #106743 for historical context.

Fun fact- some shells have mechanisms to not print / echo back “^C” when such a signal is sent to the shell. For example, for Bash, see Prevent “^C” from being printed when aborting editing current prompt (stty -ctlecho). But I’d suggest you think carefully before you do that- it could lead to future confusion for yourself if you forget that you did that.

Meta answer

A walkthrough of how I figured this out, in case you want to learn how to do it yourself in the future (it’s fun!).

  • Open https://github.dev/microsoft/vscode
  • Go to the Search View
  • Put “*.ts” in the “Files to Include” field, and “test.ts,test.js” in the “Files to Exclude” field
    • (I later adjust the exclude to “test.ts,test.js,extensions/,notebook“) since this seems to have nothing to do with notebooks, and from another similar question that I saw posted near the same time as this question post, this behaviour seems related to VS Code’s core debug functionality, and not to be extension-specific.
  • Try related searches like “^C” (make sure to turn regex search mode off, or escape the ^), “ctrl+c” (keep case-sensitive mode off), etc. Look out for any files that are related to debug or the terminal.
  • A couple lines caught my attention:
    • https://github.com/microsoft/vscode/blob/bb7bd51f30e402695e609a080a82c1eca01a729c/src/vscode-dts/vscode.proposed.terminalShellIntegration.d.ts#L86 (but I ruled this out since it pertains to a proposed API which is not yet finalized, so the Microsoft C/C++ and Python extensions wouldn’t be able to use them in their stable releases)
    • https://github.com/microsoft/vscode/blob/bb7bd51f30e402695e609a080a82c1eca01a729c/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts#L845
    • https://github.com/microsoft/vscode/blob/bb7bd51f30e402695e609a080a82c1eca01a729c/src/vs/workbench/api/node/extHostDebugService.ts#L131
  • For those last two, right click those lines in the gutter to copy a GitHub head link, open the links, switch to the Git Blame view, and see if those lines have been modified recently.
  • Click into any recent pull requests, and read about their linked issue tickets.
  • Profit.

0

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật