Crashes to desktop after setting the console buffer size and writing enough output to scroll #20825

Closed
opened 2026-01-31 07:25:06 +00:00 by claunia · 6 comments
Owner

Originally created by @jnm2 on GitHub (Nov 15, 2023).

Windows Terminal version

1.18.2822.0

Windows build number

10.0.22631.2428

Other Software

No response

Steps to reproduce

Compile and run the following .NET program. Reproed on both .NET Core/6 and .NET Framework, as expected.

using System;

public static class Program
{
    public static void Main()
    {
        Console.BufferHeight = 500;

        for (var i = 1; i < 100; i++)
        {
            Console.WriteLine(i.ToString());
        }
    }
}
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net48</TargetFramework>
  </PropertyGroup>

</Project>

Expected Behavior

No crash

Actual Behavior

Crashes to desktop, and the .NET process subsequently crashes on Console.WriteLine with System.IO.IOException: 'No process is on the other end of the pipe.' (.NET 8 doesn't crash on WriteLine, but WindowsTerminal.exe still crashes to desktop.)

When I attach a debugger to WindowsTerminal.exe and run the app, this is the exception:

Exception thrown at 0x00007FFEE7574FFC in WindowsTerminal.exe: Microsoft C++ exception: 1MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end1 at memory location 0x0000007F32BFFC00.

KernelBase.dll!00007ffee7574ffc()
igd10um64xe.dll!00007ffec24c2830()
igd10um64xe.dll!00007ffec29a1d9c()
igd10um64xe.dll!00007ffec23a3aff()
igd10um64xe.dll!00007ffec2498b26()
igd10um64xe.dll!00007ffec24d3d6a()
kernel32.dll!00007ffee7ef257d()
ntdll.dll!00007ffee9f2aa78()
Originally created by @jnm2 on GitHub (Nov 15, 2023). ### Windows Terminal version 1.18.2822.0 ### Windows build number 10.0.22631.2428 ### Other Software _No response_ ### Steps to reproduce Compile and run the following .NET program. Reproed on both .NET Core/6 and .NET Framework, as expected. ```cs using System; public static class Program { public static void Main() { Console.BufferHeight = 500; for (var i = 1; i < 100; i++) { Console.WriteLine(i.ToString()); } } } ``` ```xml <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net48</TargetFramework> </PropertyGroup> </Project> ``` ### Expected Behavior No crash ### Actual Behavior Crashes to desktop, and the .NET process subsequently crashes on Console.WriteLine with System.IO.IOException: 'No process is on the other end of the pipe.' (.NET 8 doesn't crash on WriteLine, but WindowsTerminal.exe still crashes to desktop.) When I attach a debugger to WindowsTerminal.exe and run the app, this is the exception: > Exception thrown at 0x00007FFEE7574FFC in WindowsTerminal.exe: Microsoft C++ exception: `1MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end1` at memory location 0x0000007F32BFFC00. ``` KernelBase.dll!00007ffee7574ffc() igd10um64xe.dll!00007ffec24c2830() igd10um64xe.dll!00007ffec29a1d9c() igd10um64xe.dll!00007ffec23a3aff() igd10um64xe.dll!00007ffec2498b26() igd10um64xe.dll!00007ffec24d3d6a() kernel32.dll!00007ffee7ef257d() ntdll.dll!00007ffee9f2aa78() ```
claunia added the Issue-BugResolution-Duplicate labels 2026-01-31 07:25:06 +00:00
Author
Owner

@jnm2 commented on GitHub (Nov 15, 2023):

This may be a duplicate of #16212. Looks like the common element is setting .NET's Console.BufferHeight, which is a platform call to https://learn.microsoft.com/en-us/windows/console/setconsolescreenbuffersize.

@jnm2 commented on GitHub (Nov 15, 2023): This may be a duplicate of #16212. Looks like the common element is setting .NET's Console.BufferHeight, which is a platform call to <https://learn.microsoft.com/en-us/windows/console/setconsolescreenbuffersize>.
Author
Owner

@jnm2 commented on GitHub (Nov 15, 2023):

More info: if you resize the Windows Terminal window after the buffer size is changed, it will not proceed to crash once the output starts scrolling the window.

@jnm2 commented on GitHub (Nov 15, 2023): More info: if you resize the Windows Terminal window after the buffer size is changed, it will not proceed to crash once the output starts scrolling the window.
Author
Owner

@237dmitry commented on GitHub (Nov 16, 2023):

There are no crashes in 1.19.3172.01
Tried it in two ways:

$code = @"
  using System;

  public static class Program
  {
      public static void Main()
      {
          Console.BufferHeight = 500;

          for (var i = 1; i < 100; i++)
          {
              Console.WriteLine(i.ToString());
          }
      }
  }
  "@
Add-Type -TypeDefinition $code
[Program]::Main()
[console]::BufferHeight = 500
for ($i = 1; $i -lt 100; $i++) { [console]::WriteLine($i.ToString()) }
@237dmitry commented on GitHub (Nov 16, 2023): There are no crashes in 1.19.3172.01 Tried it in two ways: ```powershell $code = @" using System; public static class Program { public static void Main() { Console.BufferHeight = 500; for (var i = 1; i < 100; i++) { Console.WriteLine(i.ToString()); } } } "@ Add-Type -TypeDefinition $code [Program]::Main() ``` ```powershell [console]::BufferHeight = 500 for ($i = 1; $i -lt 100; $i++) { [console]::WriteLine($i.ToString()) } ```
Author
Owner

@jnm2 commented on GitHub (Nov 16, 2023):

Cool. Those both repros worked to cause the crash in the older version, I just double-checked. Any idea what commit fixed this?

@jnm2 commented on GitHub (Nov 16, 2023): Cool. Those both repros worked to cause the crash in the older version, I just double-checked. Any idea what commit fixed this?
Author
Owner

@zadjii-msft commented on GitHub (Nov 17, 2023):

Yea we're gonna mark this as /dup #16199. Thanks for the neat, minimal repros!

@zadjii-msft commented on GitHub (Nov 17, 2023): Yea we're gonna mark this as /dup #16199. Thanks for the neat, minimal repros!
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Nov 17, 2023):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Nov 17, 2023): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report! <!-- Policy app identification https://img.shields.io/static/v1?label=PullRequestIssueManagement. -->
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20825