microsoft / microsoft/vscode-cpptools
Empty string in args throws IndexOutOfRangeException since v1.1.0
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Type: Debugger
Since version 1.1.0 having empty strings in the args array will give an IndexOutOfRangeException when trying to Start Debugging. This worked fine in version 1.0.1.
Issue: In launch.json "args":[ "a","","","b"]
Workaround: add extra escaped quotes in empty argument "args":[ "a","\"\"","\"\"","b"],
Describe the bug
- OS and Version: Windows 10
- VS Code Version: 1.51.1
- C/C++ Extension Version: 1.1.1
- Other extensions you installed (and if the issue persists after disabling them):
- A clear and concise description of what the bug is.
Running the debugger will give a popup with title "Visual Studio Code" and error:
Unable to start debugging. Internal error in MIEngine. Exception of type 'System.IndexOutOfRangeException' was thrown.
at MICore.LaunchOptions.QuoteArgument(String arg)
at MICore.LaunchOptions.ParseArguments(IEnumerable`1 arguments, Boolean quoteArguments)
at MICore.LaunchOptions.InitializeLaunchOptions(LaunchOptions launch)
at MICore.LocalLaunchOptions.CreateFromJson(JObject parsedOptions)
at MICore.LaunchOptions.GetInstance(HostConfigurationStore configStore, String exePath, String args, String dir, String options, Boolean noDebug, IDeviceAppLauncherEventCallback eventCallback, TargetEngine targetEngine, Logger logger)
at Microsoft.MIDebugEngine.AD7Engine.Microsoft.VisualStudio.Debugger.Interop.IDebugEngineLaunch2.LaunchSuspended(String pszServer, IDebugPort2 port, String exe, String args, String dir, String env, String options, enum_LAUNCH_FLAGS launchFlags, UInt32 hStdInput, UInt32 hStdOutput, UInt32 hStdError, IDebugEventCallback2 ad7Callback, IDebugProcess2& process)
To Reproduce
{
"name": "classic 1",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args":[ "a","","","b"],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"externalConsole": true,
"MIMode": "gdb",
}
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 with the launch.json args array shown in the issue and inspect the reported MICore.LaunchOptions.QuoteArgument and ParseArguments stack frames. Compare behavior with version 1.0.1 and 1.1.1; done means empty arguments start debugging without an IndexOutOfRangeException and the existing argument values are preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100