Omnisharp-vscode: Debugging .NET Core C# code using Console: "The handle is invalid"

Created on 22 May 2018  路  4Comments  路  Source: OmniSharp/omnisharp-vscode

_From @kierenj on May 22, 2018 6:51_

Issue Type: Bug

Run the following C# code (.NET Core) under the debugger:

var row = Console.CursorTop;

Receive the exception:

c# Exception has occurred: CLR/System.IO.IOException Exception thrown: 'System.IO.IOException' in System.Console.dll: 'The handle is invalid' at System.ConsolePal.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded) at System.Console.get_CursorTop()

This only happens when using the VS Code debug console (when debugging).

VS Code version: Code 1.23.1 (d0182c3417d225529c6d5ad24b7572815d0de9ac, 2018-05-10T17:11:17.614Z)
OS version: Windows_NT x64 10.0.16299


System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz (8 x 2494)|
|GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
video_decode: enabled
video_encode: enabled
vpx_decode: enabled
webgl: enabled
webgl2: enabled|
|Memory (System)|15.88GB (9.69GB free)|
|Process Argv|C:\Program Files\Microsoft VS Code\Code.exe|
|Screen Reader|no|
|VM|0%|

Extensions (6)

Extension|Author (truncated)|Version
---|---|---
vscode-new-file|dku|4.0.2
docomment|k--|0.1.0
azure-account|ms-|0.4.0
csharp|ms-|1.15.2
PowerShell|ms-|1.7.0
vscode-docker|Pet|0.0.27


_Copied from original issue: Microsoft/vscode#50262_

Debugger Question

Most helpful comment

_From @kierenj on May 22, 2018 6:52_

Ok, I immediately then thought to check launch.json and found console setting.

Using externalTerminal for that prop fixes this.

Is there anything that could be done to make it more obvious/easier/the internal VS code debug console work with it? Running in the integrated terminal (using powershell in VS Code) works fine..

All 4 comments

_From @kierenj on May 22, 2018 6:52_

Ok, I immediately then thought to check launch.json and found console setting.

Using externalTerminal for that prop fixes this.

Is there anything that could be done to make it more obvious/easier/the internal VS code debug console work with it? Running in the integrated terminal (using powershell in VS Code) works fine..

@kierenj we haven't come up with a reasonable way to increase the discoverability of the the console setting. If you have any good ideas, we are open.

Indeed I don't. My favourite solution would be one where the VS Code debug window works and there's no need to use externalTerminal, I suppose! I wonder why it doesn't?

The VS Code team didn't want to support providing program input from the debug console - they use input for evaluating expressions.

I will close this for now.

Was this page helpful?
0 / 5 - 0 ratings