-
Notifications
You must be signed in to change notification settings - Fork 726
Description
Environment data
.NET Command Line Tools (1.0.4)
Product Information:
Version: 1.0.4
Commit SHA-1 hash: af1e6684fd
Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.4
VS Code version: 1.15.1
C# Extension version: 1.12.1
Steps to reproduce
Create a new dotnet core console app using dotnet core 1.1
md TestProject
code TestProject
dotnet new console
To Program.cs add the line ConsoleKeyInfo key = Console.ReadKey(true);
Press F5
Expected behavior
Debug console will pause waiting for input.
Actual behavior
Exception is thrown.
Exception has occurred: CLR/System.InvalidOperationException
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Console.dll: 'Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.'
at System.ConsolePal.ReadKey(Boolean intercept)
at System.Console.ReadKey(Boolean intercept)
at UpdateTestData.Program.Main(String[] args) in c:_Home\Development\Workspaces\Web\Snowdon\UpdateTestData\Program.cs:line 24
Running the program from the terminal using dotnet TestProject
console input functions correctly. It is only when debugging in VSCode that the exception is thrown.