You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VSCode运行C++代码触发System.ArgumentOutOfRangeException及GDB连接失败问题

VSCode运行任意C++代码触发System.ArgumentOutOfRangeException异常且无法连接GDB

运行任意C++代码时,VSCode会触发System.ArgumentOutOfRangeException异常,具体报错信息如下:

Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new        
-----------------------------------------------------------------------  
Last 100 Keys:
 Space & Space ' c : Ctrl+Alt+\ U s e r s Ctrl+Alt+\ . v s c o d e Ctrl+Alt+\ e x t e n s i o n s Ctrl+Alt+\ m s - v s c o 
d e . c p p t o o l s - 1 . 1 8 . 5 - w i n 3 2 - x 6 4 Ctrl+Alt+\ d e b 
ug A d a p t e r s Ctrl+Alt+\ b i n Ctrl+Alt+\ W i n d o w s

Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.    
Parameter name: left
Actual value was -1.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.Internal.VirtualTerminal.set_CursorLeft(Int32 
value)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)  
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, 
EngineIntrinsics engineIntrinsics) 

错误出现数秒后,会弹出Windows提示框:

"Unable to start debugging. Unable to establish a connection to GDB. Debug output may contain more information."

已尝试以下方案但未解决问题:

  • 重新安装VSCode和MSYS64,问题依旧,同时不清楚Code-Runner是否为相关组件
  • 安装PSReadLine,控制台输出Cannot load PSReadline module,之后仍弹出上述提示框
  • 看到有用户提到Clear-Host命令可修复,但不知道该在何处执行

寻求有效解决办法。

内容的提问来源于stack exchange,提问作者Sam

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 21:37:38