Visual Studio 2019 - Console Unit Fails
See original GitHub issueHi
I have a unit test that compares two numbers. In VS 2017, this test passes without any issues. I installed VS 2019 and the following exception gets thrown, when running my unit tests:
Message: The handle is invalid at System.ConsolePal.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded) at System.Console.get_CursorTop()
which happens at this point in the code:
boardTop = Console.CursorTop + 1;
However. if I debug the Unit Test, it passes.
NUnit v3.11.0 NUnit 3TestAdapter v3.13.0
*Update
I have tested the units on Visual Studio 2019 for Mac and the test run correctly.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
VS 2019 Console.Writeline - Output not present in ...
My app is a C# Windows Forms App (not a WPF app). But the output is simply not appearing in the Output window...
Read more >Console window not Opening (Visual Studio 2019)
Seems like a rudimentary question but I cannot open the console window with ctrl and F5 as I used to. I start debugging...
Read more >Problems with the console in Visual studio 2019 windows
I have a problem with the console in Visual studio that I could not find a solution to for a very long time....
Read more >Visual Studio 2019 Build Failed But No Errors ...
When I right-click to Build the project, it fails but there are no errors. Each time the compilation fails, the process increases by...
Read more >Debugging in Visual Studio 2019 doesn't work if I create a ...
I have dotnet version 5.0.101. When I create a new console application in PowerShell using the command: dotnet new console and open it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@kendrahavens @OsirisTerje I’ve created https://developercommunity.visualstudio.com/content/problem/551129/change-in-behaviour-between-vs-2017-and-vs-2019-wh.html, but I’ve not provided any information about how this impacts my workflow, as the problem was experienced by @VisualSanity, I just helped to diagnose the problem. Perhaps @VisualSanity can provide the information on developercommunity.
@mikkelbu I believe this is a Visual Studio issue. We did change some behavior in the console window in Visual Studio 2019. Could you open a bug on https://developercommunity.visualstudio.com/ ? Thank you for including the repro solution! Any details you can include on how this impacts your workflow would be greatly appreciated. (i.e. Let us know if this is a major breaking scenario!)
I am also observing this on my machine, but am not sure of the cause. Filing it on developer community will help route it to the right team.