Visual Studio 2019 hanging in cout/printf

Tyler 1 Reputation point
2021-10-10T17:28:29.87+00:00

When debugging in Visual Studio 2019, any time my program attempts to cout or print it causes the debugger to stall infinitely. If I pause the debugger and look at the main thread, it will always be in 'ucrtbased.dll!write_text_ansi_nolock' once it gets stalled.

When I run the built exe on it's own, it prints to console perfectly fine. The stalling happens while the application is single threaded, just trying to console print out a single line of text with no variables.

How can I fix this, or look inside the above DLL to see what is happening?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,880 questions
{count} votes

6 answers

Sort by: Most helpful
  1. Igor Polkovnikov 0 Reputation points
    2023-04-17T23:51:48.6833333+00:00

    I have the same. VC2022. It hangs in KernelBase WriteFile. After removing .vs it run at least twice fine. Version 17.2.6, x86, Debug

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.