ArgumentOutOfRangeException occurs when an application's output is greater than the console's buffer #6147

Closed
opened 2026-01-31 00:30:58 +00:00 by claunia · 3 comments
Owner

Originally created by @SolidKnight on GitHub (Jan 26, 2020).

Environment

Windows build number: Any version of Windows 10
Windows Terminal version (if applicable): Any version of Terminal for Windows (this bug dates back to the first preview)

Any other software?
The Intune Content Prep Tool

Steps to reproduce

  1. Make the Terminal window small.

  2. Use an application such as Intune Content Prep Tool
    https://github.com/microsoft/Microsoft-Win32-Content-Prep-Tool

  3. Using the Intune Content Prep tool as an example, attempt to use the tool.
    E.g. IntuneWinAppUtil.exe -c C:\Temp\Test -s PowerShell-6.2.2-win-x64.msi -o C:\Temp

Expected behavior

The tool would run fine.

Actual behavior

The following error is thrown and the tool crashes

System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: targetTop
Actual value was 38.
   at System.Console.MoveBufferArea(Int32 sourceLeft, Int32 sourceTop, Int32 sourceWidth, Int32 sourceHeight, Int32 targetLeft, Int32 targetTop, Char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor)
   at Microsoft.Management.Service.IntuneWinAppUtil.LogUtil.PrintProgress(AppContext context)
   at Microsoft.Management.Service.IntuneWinAppUtil.LogUtil.WriteLine(AppContext context, String text)
   at Microsoft.Management.Service.IntuneWinAppUtil.PackageUtil.CreatePackage(String folder, String setupFile, String outputFolder, String catalogFolder)
   at Microsoft.Management.Service.IntuneWinAppUtil.Program.Main(String[] args)
Originally created by @SolidKnight on GitHub (Jan 26, 2020). # Environment ``` Windows build number: Any version of Windows 10 Windows Terminal version (if applicable): Any version of Terminal for Windows (this bug dates back to the first preview) Any other software? The Intune Content Prep Tool ``` # Steps to reproduce 1. Make the Terminal window small. 2. Use an application such as Intune Content Prep Tool https://github.com/microsoft/Microsoft-Win32-Content-Prep-Tool 3. Using the Intune Content Prep tool as an example, attempt to use the tool. E.g. IntuneWinAppUtil.exe -c C:\Temp\Test -s PowerShell-6.2.2-win-x64.msi -o C:\Temp # Expected behavior The tool would run fine. # Actual behavior The following error is thrown and the tool crashes ``` System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension. Parameter name: targetTop Actual value was 38. at System.Console.MoveBufferArea(Int32 sourceLeft, Int32 sourceTop, Int32 sourceWidth, Int32 sourceHeight, Int32 targetLeft, Int32 targetTop, Char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor) at Microsoft.Management.Service.IntuneWinAppUtil.LogUtil.PrintProgress(AppContext context) at Microsoft.Management.Service.IntuneWinAppUtil.LogUtil.WriteLine(AppContext context, String text) at Microsoft.Management.Service.IntuneWinAppUtil.PackageUtil.CreatePackage(String folder, String setupFile, String outputFolder, String catalogFolder) at Microsoft.Management.Service.IntuneWinAppUtil.Program.Main(String[] args) ```
claunia added the Resolution-ExternalNeeds-Tag-FixNeeds-Attention labels 2026-01-31 00:30:58 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Jan 27, 2020):

I mean, that seems to me like it's a bug in the Intune Content Prep Tool, right? They could absolutely catch this exception, or they could query the buffer size first before trying to draw their progress bar. If not them, then whatever library they're using should probably be handling this case. It's perfectly reasonable for the console window to be small, and the client software should be robust enough to handle this case.

Unless of course, this scenario worked on a previous build of Windows, and recently regressed. Then that's our fault and we can do something about it.

@zadjii-msft commented on GitHub (Jan 27, 2020): I mean, that seems to me like it's a bug in the Intune Content Prep Tool, right? They could absolutely catch this exception, or they could query the buffer size first before trying to draw their progress bar. If not them, then whatever library they're using should probably be handling this case. It's perfectly reasonable for the console window to be small, and the client software should be robust enough to handle this case. **Unless** of course, this scenario worked on a previous build of Windows, and recently regressed. Then that's our fault and we can do something about it.
Author
Owner

@SolidKnight commented on GitHub (Jan 27, 2020):

I don't recall it ever working on previous versions of Terminal but the Terminal app is the only app I know of where this bug occurs. I added this same information to the issues list on the content prep tool's GitHub as, like you said, it could easily be their problem.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Mike Griese notifications@github.com
Sent: Monday, January 27, 2020 8:58:13 AM
To: microsoft/terminal terminal@noreply.github.com
Cc: SolidKnight solidknight@hotmail.com; Author author@noreply.github.com
Subject: Re: [microsoft/terminal] ArgumentOutOfRangeException occurs when an application's output is greater than the console's buffer (#4361)

I mean, that seems to me like it's a bug in the Intune Content Prep Tool, right? They could absolutely catch this exception, or they could query the buffer size first before trying to draw their progress bar. If not them, then whatever library they're using should probably be handling this case. It's perfectly reasonable for the console window to be small, and the client software should be robust enough to handle this case.

Unless of course, this scenario worked on a previous build of Windows, and recently regressed. Then that's our fault and we can do something about it.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/microsoft/terminal/issues/4361?email_source=notifications&email_token=AHRIFS3JGHP34DEEEJFYEVTQ73ZALA5CNFSM4KLXSEO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ7ZWTI#issuecomment-578788173, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHRIFS6TN2RNVHGSOOWNY2LQ73ZALANCNFSM4KLXSEOQ.

@SolidKnight commented on GitHub (Jan 27, 2020): I don't recall it ever working on previous versions of Terminal but the Terminal app is the only app I know of where this bug occurs. I added this same information to the issues list on the content prep tool's GitHub as, like you said, it could easily be their problem. Get Outlook for Android<https://aka.ms/ghei36> ________________________________ From: Mike Griese <notifications@github.com> Sent: Monday, January 27, 2020 8:58:13 AM To: microsoft/terminal <terminal@noreply.github.com> Cc: SolidKnight <solidknight@hotmail.com>; Author <author@noreply.github.com> Subject: Re: [microsoft/terminal] ArgumentOutOfRangeException occurs when an application's output is greater than the console's buffer (#4361) I mean, that seems to me like it's a bug in the Intune Content Prep Tool, right? They could absolutely catch this exception, or they could query the buffer size first before trying to draw their progress bar. If not them, then whatever library they're using should probably be handling this case. It's perfectly reasonable for the console window to be small, and the client software should be robust enough to handle this case. Unless of course, this scenario worked on a previous build of Windows, and recently regressed. Then that's our fault and we can do something about it. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<https://github.com/microsoft/terminal/issues/4361?email_source=notifications&email_token=AHRIFS3JGHP34DEEEJFYEVTQ73ZALA5CNFSM4KLXSEO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ7ZWTI#issuecomment-578788173>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHRIFS6TN2RNVHGSOOWNY2LQ73ZALANCNFSM4KLXSEOQ>.
Author
Owner

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

Unfortunately, I've gotta close this one external. Thanks for the info!

@DHowett-MSFT commented on GitHub (Jan 31, 2020): Unfortunately, I've gotta close this one external. Thanks for the info!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6147