Tab exits with code 1 when Console.SetBufferSize has been modified and you maximize window #10558

Open
opened 2026-01-31 02:24:38 +00:00 by claunia · 3 comments
Owner

Originally created by @ajkennedy-HEC on GitHub (Sep 9, 2020).

Possibly related to #1461. I understand the text rendering errors, but the process exiting is different.

When I set the console buffer size to maximum height and run my code from Windows Terminal (in non-maximized, 'windowed' mode), everything appears to work correctly. Windows Terminal honors the buffer-size that I've set, and I can scroll back in history appropriately.

If I maximize that window after running the program, the tab process exits with code 1.

A small C# program that reproduces this issue:

    static void Main(string[] args)
    {
      Console.SetBufferSize(Console.BufferWidth, 32766);
      Console.WriteLine("Buffer size changed.");

      // 100 lines is roughly the minimum it takes to crash the tab. Small behavior changes
      // depending on my initial window size. 
      for (int i = 0; i < 100; i++)
      {
        Console.WriteLine("Line");
      }
    }

image

Windows Version 2004, OS Build 19041.450
Windows Terminal Version 1.2.2381.0

Originally created by @ajkennedy-HEC on GitHub (Sep 9, 2020). Possibly related to #1461. I understand the text rendering errors, but the process exiting is different. When I set the console buffer size to maximum height and run my code from Windows Terminal (in non-maximized, 'windowed' mode), everything appears to work correctly. Windows Terminal honors the buffer-size that I've set, and I can scroll back in history appropriately. If I maximize that window after running the program, the tab process exits with code 1. A small C# program that reproduces this issue: ``` static void Main(string[] args) { Console.SetBufferSize(Console.BufferWidth, 32766); Console.WriteLine("Buffer size changed."); // 100 lines is roughly the minimum it takes to crash the tab. Small behavior changes // depending on my initial window size. for (int i = 0; i < 100; i++) { Console.WriteLine("Line"); } } ``` ![image](https://user-images.githubusercontent.com/14296437/92624793-c39e0100-f27c-11ea-9daa-6287c77cbc5d.png) Windows Version 2004, OS Build 19041.450 Windows Terminal Version 1.2.2381.0
Author
Owner

@DHowett commented on GitHub (Sep 9, 2020):

Alright, there's gonna be two fixes here: rejecting making the buffer taller than the viewport (sorry, but we've got to do that -- it'll also fix #4062) and fixing the openconsole/conpty crash.

@DHowett commented on GitHub (Sep 9, 2020): Alright, there's gonna be two fixes here: rejecting making the buffer taller than the viewport (sorry, but we've got to do that -- it'll also fix #4062) and fixing the openconsole/conpty crash.
Author
Owner

@flevi29 commented on GitHub (Nov 25, 2020):

Oh, that's sad, but understandable. Changing buffer size also causes some weird behavior, where if I resize Windows Terminal a few times the text kinda corrupts.
Screenshot 2020-11-25 144825

@flevi29 commented on GitHub (Nov 25, 2020): Oh, that's sad, but understandable. Changing buffer size also causes some weird behavior, where if I resize Windows Terminal a few times the text kinda corrupts. ![Screenshot 2020-11-25 144825](https://user-images.githubusercontent.com/55688616/100229684-4c981080-2f2d-11eb-9b95-59db88b48db8.png)
Author
Owner

@DHowett commented on GitHub (Nov 25, 2020):

Indeed, that’s why we will have to reject buffer size changes 😄

@DHowett commented on GitHub (Nov 25, 2020): Indeed, that’s why we will have to reject buffer size changes :smile:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10558