In my case, it got fixed by focusing on the cmd window and pressing space.
I guess (but I am not sure) that what happened was that I clicked on the cmd window and selected something by mistake; this usually freezes the application until you press a key and the selection disappears from the cmd window.
At least, I can reproduce it: just start debugging, click and drag on the cmd window (so something is selected), and then restart the debugger session. It will freeze in the WriteFile() of the write_text_ansi_nolock(). If you restart the debugging session (by pressing the stop button and play button in VS 2022), it freezes again at the same place. Once you focus on the cmd window and press a key, so the selection disappears, everything goes back to normal.
I am not sure that this is happening to anyone else, but at least it's something to try out.
I hope it helps someone :)