Vb: conhost still crashes (disappears?) on resize in the alt buffer #6063

Closed
opened 2026-01-31 00:28:52 +00:00 by claunia · 10 comments
Owner

Originally created by @joaobzrr on GitHub (Jan 21, 2020).

Windows build number: 19013.1102

Steps to reproduce

  • Disable "Wrap text output on resize" console option.
  • Compile the code below and run Visual Studio with the executable.
#include <windows.h>
#include <stdio.h>

int main(int argc, char **argv)
{
    HANDLE con_out = CreateFile("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
    if (con_out != INVALID_HANDLE_VALUE)
    {
        DWORD con_out_mode;
        GetConsoleMode(con_out, &con_out_mode);
        con_out_mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
        SetConsoleMode(con_out, con_out_mode);

        printf("\x1b[?1049h");
        printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
    }
}
  • Put a breakpoint at the first line of main() then start debugging or just hit F10 to have the debugger stop at the beginning. When you break, maximize the console window.
  • Step through until this line
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");

is executed.

  • Restore the window to its previous size by clicking the restore button or double clicking the window title bar.

Expected behavior

The console window should remain visible.

Actual behavior

The program appears to crash, but it's actually still running. The console window disappears but the process is still visible in the task manager. You can't kill the process unless you close Visual Studio.

Originally created by @joaobzrr on GitHub (Jan 21, 2020). ``` Windows build number: 19013.1102 ``` # Steps to reproduce - Disable "Wrap text output on resize" console option. - Compile the code below and run Visual Studio with the executable. ```cpp #include <windows.h> #include <stdio.h> int main(int argc, char **argv) { HANDLE con_out = CreateFile("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0); if (con_out != INVALID_HANDLE_VALUE) { DWORD con_out_mode; GetConsoleMode(con_out, &con_out_mode); con_out_mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; SetConsoleMode(con_out, con_out_mode); printf("\x1b[?1049h"); printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); } } ``` - Put a breakpoint at the first line of main() then start debugging or just hit F10 to have the debugger stop at the beginning. When you break, maximize the console window. - Step through until this line ```cpp printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); ``` is executed. - Restore the window to its previous size by clicking the restore button or double clicking the window title bar. # Expected behavior The console window should remain visible. # Actual behavior The program appears to crash, but it's actually still running. The console window disappears but the process is still visible in the task manager. You can't kill the process unless you close Visual Studio.
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 21, 2020):

This sounds like #1206, but I can't reproduce it here. Can you try again on 19041? 19013 is pretty old by insider standards (Oct 2019).

@DHowett-MSFT commented on GitHub (Jan 21, 2020): This sounds like #1206, but I can't reproduce it here. Can you try again on 19041? 19013 is pretty old by insider standards (Oct 2019).
Author
Owner

@joaobzrr commented on GitHub (Jan 21, 2020):

Sorry, but that won't be possible. You'll have to, if you want to, do that on your end.

@joaobzrr commented on GitHub (Jan 21, 2020): Sorry, but that won't be possible. You'll have to, if you want to, do that on your end.
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 21, 2020):

It is unusual that you are isolated on an insider's build that's going to be out of support very soon. Alas!

I can't reproduce this on 19011, 19013 or 19041.

@DHowett-MSFT commented on GitHub (Jan 21, 2020): It is unusual that you are isolated on an insider's build that's going to be out of support very soon. Alas! I can't reproduce this on 19011, 19013 or 19041.
Author
Owner

@joaobzrr commented on GitHub (Jan 22, 2020):

Ignore my previous post. I'll try it on 19041 and let you know what happens as soon as possible.

@joaobzrr commented on GitHub (Jan 22, 2020): Ignore my previous post. I'll try it on 19041 and let you know what happens as soon as possible.
Author
Owner

@joaobzrr commented on GitHub (Jan 22, 2020):

Okay, I tried it on 19041 and the same thing is happening.

@joaobzrr commented on GitHub (Jan 22, 2020): Okay, I tried it on 19041 and the same thing is happening.
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 23, 2020):

Thanks for confirming!

@DHowett-MSFT commented on GitHub (Jan 23, 2020): Thanks for confirming!
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 24, 2020):

You don't need to file a separate issue -- this is the issue we will use to track this problem. Thank you!

@DHowett-MSFT commented on GitHub (Jan 24, 2020): You don't need to file a separate issue -- this is the issue we will use to track this problem. Thank you!
Author
Owner

@joaobzrr commented on GitHub (Jan 24, 2020):

@DHowett-MSFT I'm really sorry, I meant to post that on another issue.

@joaobzrr commented on GitHub (Jan 24, 2020): @DHowett-MSFT I'm really sorry, I meant to post that on another issue.
Author
Owner

@zadjii-msft commented on GitHub (Dec 9, 2021):

Hey so it's been almost 2 years now - I just tried this on a conhost on windows 11, on 22510, and this looks fixed to me. @joaobzrr can you try reproing this again on a newer build? I think this may have gotten fixed in the last two years, but I haven't a clue as to what did it.

@zadjii-msft commented on GitHub (Dec 9, 2021): Hey so it's been almost 2 years now - I just tried this on a conhost on windows 11, on 22510, and this looks fixed to me. @joaobzrr can you try reproing this again on a newer build? I think this may have gotten fixed in the last two years, but I haven't a clue as to what did it.
Author
Owner

@ghost commented on GitHub (Dec 13, 2021):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Dec 13, 2021): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6063