ReadKey InvalidOperationException application does not have a console

Found my answer in OmniSharp Visual Code docs: https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window

Console (terminal) window

By default, processes are launched with their console output
(stdout/stderr) going to the VS Code Debugger Console. This is useful
for executables that take their input from the network, files, etc.
But this does NOT work for applications that want to read from the
console (ex: Console.ReadLine). For these applications, use a setting
such as the following:

“console”: “integratedTerminal” When this is set to integratedTerminal
the target process will run inside VS Code’s integrated terminal.
Click the ‘Terminal’ tab in the tab group beneath the editor to
interact with your application.

When this is set to externalTerminal the target process will run in a
separate terminal.

I changed this setting in launch.json and now it works

Leave a Comment