Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging .NET Core C# code using Console: "The handle is invalid" #2336

Closed
roblourens opened this issue May 22, 2018 · 4 comments
Closed

Debugging .NET Core C# code using Console: "The handle is invalid" #2336

roblourens opened this issue May 22, 2018 · 4 comments

Comments

@roblourens
Copy link

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:

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

@roblourens
Copy link
Author

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..

@gregg-miskelly
Copy link
Contributor

@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.

@kierenj
Copy link

kierenj commented May 23, 2018

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?

@gregg-miskelly
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants