Frequent process failures due to GetConsoleScreenBufferInfoEx failing #7847

Closed
opened 2026-01-31 01:14:08 +00:00 by claunia · 11 comments
Owner

Originally created by @AArnott on GitHub (Apr 30, 2020).

Environment

Windows build number: 10.0.19041.0
Windows Terminal version (if applicable): 0.11.1191.0

I'm running PowerShell within the terminal.

Steps to reproduce

Run msbuild.exe or dotnet build.
Resizing the window during the build is not necessary, but may increase the frequency of the failure.

Expected behavior

No errors or build breaks.

Actual behavior

Evidently some processes that are attached to the console and spawned from within the Windows Terminal call GetConsoleScreenBufferInfoEx and it frequently fails with GetConsoleScreenBufferInfoEx->WinError: #6, as shown below:

INFO  00:02:02.377: Targets status: Progress 97.4 %, Pending 1, Ready 0, NotStarted 0, Failed 0, Succeeded 37, FromCache 36, Cache download rate: 0.0 Mbps
INFO  00:02:12.468: Targets status: Progress 97.4 %, Pending 1, Ready 0, NotStarted 0, Failed 0, Succeeded 37, FromCache 36, Cache download rate: 0.0 Mbps
ERROR Command src\env\shell\UIInternal_Checked_X86 (src\env\shell\UIInternal) finished with result Failed, reason: EXEC : error : "GetConsoleScreenBufferInfoEx->WinError: #6"
Log location: \\DESKTOP-CA1DFI9\D$\VS\src\env\shell\UIInternal\Logs\Checked\X86

This causes frequent build breaks. Restarting the build will usually get the build to pass or at least get further along, so I just repeat the build until it finally succeeds.

I've never seen this outside of Windows Terminal.

Originally created by @AArnott on GitHub (Apr 30, 2020). # Environment ```none Windows build number: 10.0.19041.0 Windows Terminal version (if applicable): 0.11.1191.0 ``` I'm running PowerShell within the terminal. # Steps to reproduce Run msbuild.exe or `dotnet build`. Resizing the window during the build is _not_ necessary, but *may* increase the frequency of the failure. # Expected behavior No errors or build breaks. # Actual behavior Evidently some processes that are attached to the console and spawned from within the Windows Terminal call `GetConsoleScreenBufferInfoEx` and it frequently fails with `GetConsoleScreenBufferInfoEx->WinError: #6`, as shown below: ``` INFO 00:02:02.377: Targets status: Progress 97.4 %, Pending 1, Ready 0, NotStarted 0, Failed 0, Succeeded 37, FromCache 36, Cache download rate: 0.0 Mbps INFO 00:02:12.468: Targets status: Progress 97.4 %, Pending 1, Ready 0, NotStarted 0, Failed 0, Succeeded 37, FromCache 36, Cache download rate: 0.0 Mbps ERROR Command src\env\shell\UIInternal_Checked_X86 (src\env\shell\UIInternal) finished with result Failed, reason: EXEC : error : "GetConsoleScreenBufferInfoEx->WinError: #6" Log location: \\DESKTOP-CA1DFI9\D$\VS\src\env\shell\UIInternal\Logs\Checked\X86 ``` This causes *frequent* build breaks. Restarting the build will usually get the build to pass or at least get further along, so I just repeat the build until it finally succeeds. I've never seen this outside of Windows Terminal.
claunia added the Resolution-ExternalNeeds-Tag-FixNeeds-Attention labels 2026-01-31 01:14:08 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (May 1, 2020):

Wow, this is really strange. That error indicates that the "handle is invalid" -- which is absolutely not how the pseudoconsole is supposed to work. It looks like it's failing to execute a different binary. Can you try to figure out which binary that is? I'd like to make sure it works over the PTY.

@DHowett-MSFT commented on GitHub (May 1, 2020): Wow, this is really strange. That error indicates that the "handle is invalid" -- which is absolutely not how the pseudoconsole is supposed to work. It looks like it's failing to execute a different binary. Can you try to figure out which binary that is? I'd like to make sure it works over the PTY.
Author
Owner

@AArnott commented on GitHub (May 2, 2020):

It happens often, and did this morning. But now that I'm trying to get the answer to your question, it's not repro'ing. Gah! I'll keep trying. I'm sure it will happen within a few days. I mean, on average it happens at least a dozen times a day -- except ... now.

@AArnott commented on GitHub (May 2, 2020): It happens often, and did this morning. But now that I'm trying to get the answer to your question, it's not repro'ing. Gah! I'll keep trying. I'm sure it will happen within a few days. I mean, on average it happens at least a dozen times a day -- except ... now.
Author
Owner

@AArnott commented on GitHub (May 4, 2020):

OK, so here's much more of the log around the error:

         Set COMPLUS_InstallRoot=& Set COMPLUS_Version=& Set PATH=C:\Users\andarno\AppData\Local\CloudBuild\quickbuild\f971769e51d0066b37ad15d2db0218b078cc6187\lib\win32\x64;D:\VS\out\gen\InPath;C:\Users\andarno\AppData\Local\devconsole\pkgs\DevConsole.Commandline\5.1.49;;D:\NugetCache\Corext.Build.2.1.5\InPath;;D:\NugetCache\RazzleBuildTools.Corext.2.2.1\x86;D:\NugetCache\VS.Tools.Roslyn.3.7.0-1.20222.2\;;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Current\bin;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Extensions\Override\etc\TaskCopy;D:\VS\src\Tools\x86\managed\v4.5;D:\VS\src\Tools\x86\managed\v4.5\tf12;D:\VS\src\Tools\x86\managed\v4.5\tf11;D:\VS\src\tools\Vctools\Dev16\build\native\..\..\lib\native\bin\Hostx86\x86;D:\VS\src\Tools\x86;D:\VS\src\Tools\perl\bin;D:\VS\src\Tools\perl\c\bin;D:\VS\src\Tools;D:\VS\src\Tools\devdiv\decatur;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;D:\VS\src\Tools\devdiv\x86\bbt\toolset;D:\VS\src\Tools\BuildCop\x86;D:\VS\src\Tools\Python;;D:\VS\src\Tools\dotnet;D:\VS\src\Tools\devdiv\internal;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;;C:\Program Files\Git\cmd;;;;;;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Path;D:\NugetCache\RazzleBuildTools.Corext.2.2.1\x86;D:\NugetCache\RazzleBuildTools.Corext.2.2.1;D:\NugetCache\VS.Tools.Roslyn.3.7.0-1.20222.2\;;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Current\bin;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Extensions\Override\etc\TaskCopy;D:\VS\src\Tools\x86\managed\v4.5;D:\VS\src\Tools\x86\managed\v4.5\tf12;D:\VS\src\Tools\x86\managed\v4.5\tf11;D:\VS\src\tools\Vctools\Dev16\build\native\..\..\lib\native\bin\Hostx86\x86;D:\VS\src\Tools\x86;D:\VS\src\Tools\perl\bin;D:\VS\src\Tools\perl\c\bin;D:\VS\src\Tools;D:\VS\src\Tools\devdiv\decatur;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;D:\VS\src\Tools\devdiv\x86\bbt\toolset;D:\VS\src\Tools\BuildCop\x86;D:\VS\src\Tools\Python;;D:\VS\src\Tools\dotnet;D:\VS\src\Tools\devdiv\internal;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;;D:\VS\src\Tools\x86\prefast\scripts;;D:\NugetCache\VS.Tools.Net.Core.SDK.x86.3.1.200-servicing-015018\;D:\VS\out\gen\InPath;C:\Users\andarno\AppData\Local\devconsole\pkgs\DevConsole.Commandline\5.1.49;C:\Python38\Scripts\;C:\Python38\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\GitExtensions\;C:\Program Files\PowerShell\7\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\andarno\AppData\Local\CloudBuild;C:\Users\andarno\AppData\Local\CloudBuild;C:\Users\andarno\AppData\Local\Microsoft\WindowsApps;C:\Users\andarno\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\andarno\.dotnet\tools;d:\tools;C:\Program Files\Git\usr\bin;C:\Users\andarno\AppData\Roaming\npm;C:\Program Files (x86)\GitHub CLI\;C:\Users\andarno\AppData\Local\Programs\Fiddler;D:\tools\ILSpy\;C:\Users\andarno\AppData\Local\Keybase\;C:\Program Files\7-Zip;C:\Users\andarno\AppData\Local\Microsoft\WindowsApps;C:\Users\andarno\.nuget\packages\xunit.runner.console\2.4.1\tools\net472;D:\NugetCache\NetFx.SdkTools.Internal.4.6.1-1\bin;D:\VS\src\Shared\Tools\Scripts\;D:\VS\src\..\tools\Scripts\;D:\VS\src\Tools\git.extensions;D:\VS\src\tools\vstspt & %windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy bypass -Command D:\VS\.corext\DetermineIfUpdatesAreRequired.ps1
         Exception calling "ResetConsolePalette" with "0" argument(s): "GetConsoleScreenBufferInfoEx->WinError: #6"
         At D:\users\andarno\OneDrive - Microsoft\Documents\WindowsPowerShell\Modules\PowerLine\3.1.2\PowerLine.psm1:679 char:5
         +     [PoshCode.Pansies.RgbColor]::ResetConsolePalette()
         +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
             + FullyQualifiedErrorId : Exception
          
         Write-Host : Cannot bind parameter 'ForegroundColor'. Cannot convert value "Yellow" to type 
     1>EXEC : "PoshCode.Pansies.RgbColor". error : "GetConsoleScreenBufferInfoEx->WinError: #6"
         At D:\VS\.corext\DetermineIfUpdatesAreRequired.ps1:17 char:37
         +         Write-Host -ForegroundColor Yellow "CoreXT updates are requir ...
         +                                     ~~~~~~
             + CategoryInfo          : InvalidArgument: (:) [Write-Host], ParameterBindingException
             + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,PoshCode.Pansies.Commands.WriteHostCommand
          
         The command "Set COMPLUS_InstallRoot=& Set COMPLUS_Version=& Set PATH=C:\Users\andarno\AppData\Local\CloudBuild\quickbuild\f971769e51d0066b37ad15d2db0218b078cc6187\lib\win32\x64;D:\VS\out\gen\InPath;C:\Users\andarno\AppData\Local\devconsole\pkgs\DevConsole.Commandline\5.1.49;;D:\NugetCache\Corext.Build.2.1.5\InPath;;D:\NugetCache\RazzleBuildTools.Corext.2.2.1\x86;D:\NugetCache\VS.Tools.Roslyn.3.7.0-1.20222.2\;;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Current\bin;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Extensions\Override\etc\TaskCopy;D:\VS\src\Tools\x86\managed\v4.5;D:\VS\src\Tools\x86\managed\v4.5\tf12;D:\VS\src\Tools\x86\managed\v4.5\tf11;D:\VS\src\tools\Vctools\Dev16\build\native\..\..\lib\native\bin\Hostx86\x86;D:\VS\src\Tools\x86;D:\VS\src\Tools\perl\bin;D:\VS\src\Tools\perl\c\bin;D:\VS\src\Tools;D:\VS\src\Tools\devdiv\decatur;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;D:\VS\src\Tools\devdiv\x86\bbt\toolset;D:\VS\src\Tools\BuildCop\x86;D:\VS\src\Tools\Python;;D:\VS\src\Tools\dotnet;D:\VS\src\Tools\devdiv\internal;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;;C:\Program Files\Git\cmd;;;;;;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Path;D:\NugetCache\RazzleBuildTools.Corext.2.2.1\x86;D:\NugetCache\RazzleBuildTools.Corext.2.2.1;D:\NugetCache\VS.Tools.Roslyn.3.7.0-1.20222.2\;;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Current\bin;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Extensions\Override\etc\TaskCopy;D:\VS\src\Tools\x86\managed\v4.5;D:\VS\src\Tools\x86\managed\v4.5\tf12;D:\VS\src\Tools\x86\managed\v4.5\tf11;D:\VS\src\tools\Vctools\Dev16\build\native\..\..\lib\native\bin\Hostx86\x86;D:\VS\src\Tools\x86;D:\VS\src\Tools\perl\bin;D:\VS\src\Tools\perl\c\bin;D:\VS\src\Tools;D:\VS\src\Tools\devdiv\decatur;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;D:\VS\src\Tools\devdiv\x86\bbt\toolset;D:\VS\src\Tools\BuildCop\x86;D:\VS\src\Tools\Python;;D:\VS\src\Tools\dotnet;D:\VS\src\Tools\devdiv\internal;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;;D:\VS\src\Tools\x86\prefast\scripts;;D:\NugetCache\VS.Tools.Net.Core.SDK.x86.3.1.200-servicing-015018\;D:\VS\out\gen\InPath;C:\Users\andarno\AppData\Local\devconsole\pkgs\DevConsole.Commandline\5.1.49;C:\Python38\Scripts\;C:\Python38\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\GitExtensions\;C:\Program Files\PowerShell\7\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\andarno\AppData\Local\CloudBuild;C:\Users\andarno\AppData\Local\CloudBuild;C:\Users\andarno\AppData\Local\Microsoft\WindowsApps;C:\Users\andarno\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\andarno\.dotnet\tools;d:\tools;C:\Program Files\Git\usr\bin;C:\Users\andarno\AppData\Roaming\npm;C:\Program Files (x86)\GitHub CLI\;C:\Users\andarno\AppData\Local\Programs\Fiddler;D:\tools\ILSpy\;C:\Users\andarno\AppData\Local\Keybase\;C:\Program Files\7-Zip;C:\Users\andarno\AppData\Local\Microsoft\WindowsApps;C:\Users\andarno\.nuget\packages\xunit.runner.console\2.4.1\tools\net472;D:\NugetCache\NetFx.SdkTools.Internal.4.6.1-1\bin;D:\VS\src\Shared\Tools\Scripts\;D:\VS\src\..\tools\Scripts\;D:\VS\src\Tools\git.extensions;D:\VS\src\tools\vstspt & %windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy bypass -Command D:\VS\.corext\DetermineIfUpdatesAreRequired.ps1" exited with code 1.
     1>D:\VS\QLocal\cmd\0\src\ConfigData\BuildTargets\Microsoft.DevDiv.Asserts.targets(54,5): error : One or more packages is out of date. Please run 'D:\VS\init.cmd' to update packages before building again. See http://aka.ms/dd1es-help . DetermineIfUpdatesAreRequired.ps1 output: Exception calling "ResetConsolePalette" with "0" argument(s): "GetConsoleScreenBufferInfoEx->WinError: #6";At D:\users\andarno\OneDrive - Microsoft\Documents\WindowsPowerShell\Modules\PowerLine\3.1.2\PowerLine.psm1:679 char:5;+     [PoshCode.Pansies.RgbColor]::ResetConsolePalette();+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException;+ FullyQualifiedErrorId : Exception;Write-Host : Cannot bind parameter 'ForegroundColor'. Cannot convert value "Yellow" to type;"PoshCode.Pansies.RgbColor". Error: "GetConsoleScreenBufferInfoEx->WinError: #6";At D:\VS\.corext\DetermineIfUpdatesAreRequired.ps1:17 char:37;+         Write-Host -ForegroundColor Yellow "CoreXT updates are requir ...;+                                     ~~~~~~;+ CategoryInfo          : InvalidArgument: (:) [Write-Host], ParameterBindingException;+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,PoshCode.Pansies.Commands.WriteHostCommand.
     1>Done Building Project "D:\VS\QLocal\cmd\0\src\env\shell\PackageFramework\Framework\Microsoft.VisualStudio.Shell.Framework.csproj" (Build target(s)) -- FAILED.

This aligns with my perception that this bug showed up at the same time I started using powerline. The EXEC is a spawn of a new powershell.exe child process that then calls ResetConsolePalette

@AArnott commented on GitHub (May 4, 2020): OK, so here's much more of the log around the error: ``` Set COMPLUS_InstallRoot=& Set COMPLUS_Version=& Set PATH=C:\Users\andarno\AppData\Local\CloudBuild\quickbuild\f971769e51d0066b37ad15d2db0218b078cc6187\lib\win32\x64;D:\VS\out\gen\InPath;C:\Users\andarno\AppData\Local\devconsole\pkgs\DevConsole.Commandline\5.1.49;;D:\NugetCache\Corext.Build.2.1.5\InPath;;D:\NugetCache\RazzleBuildTools.Corext.2.2.1\x86;D:\NugetCache\VS.Tools.Roslyn.3.7.0-1.20222.2\;;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Current\bin;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Extensions\Override\etc\TaskCopy;D:\VS\src\Tools\x86\managed\v4.5;D:\VS\src\Tools\x86\managed\v4.5\tf12;D:\VS\src\Tools\x86\managed\v4.5\tf11;D:\VS\src\tools\Vctools\Dev16\build\native\..\..\lib\native\bin\Hostx86\x86;D:\VS\src\Tools\x86;D:\VS\src\Tools\perl\bin;D:\VS\src\Tools\perl\c\bin;D:\VS\src\Tools;D:\VS\src\Tools\devdiv\decatur;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;D:\VS\src\Tools\devdiv\x86\bbt\toolset;D:\VS\src\Tools\BuildCop\x86;D:\VS\src\Tools\Python;;D:\VS\src\Tools\dotnet;D:\VS\src\Tools\devdiv\internal;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;;C:\Program Files\Git\cmd;;;;;;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Path;D:\NugetCache\RazzleBuildTools.Corext.2.2.1\x86;D:\NugetCache\RazzleBuildTools.Corext.2.2.1;D:\NugetCache\VS.Tools.Roslyn.3.7.0-1.20222.2\;;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Current\bin;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Extensions\Override\etc\TaskCopy;D:\VS\src\Tools\x86\managed\v4.5;D:\VS\src\Tools\x86\managed\v4.5\tf12;D:\VS\src\Tools\x86\managed\v4.5\tf11;D:\VS\src\tools\Vctools\Dev16\build\native\..\..\lib\native\bin\Hostx86\x86;D:\VS\src\Tools\x86;D:\VS\src\Tools\perl\bin;D:\VS\src\Tools\perl\c\bin;D:\VS\src\Tools;D:\VS\src\Tools\devdiv\decatur;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;D:\VS\src\Tools\devdiv\x86\bbt\toolset;D:\VS\src\Tools\BuildCop\x86;D:\VS\src\Tools\Python;;D:\VS\src\Tools\dotnet;D:\VS\src\Tools\devdiv\internal;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;;D:\VS\src\Tools\x86\prefast\scripts;;D:\NugetCache\VS.Tools.Net.Core.SDK.x86.3.1.200-servicing-015018\;D:\VS\out\gen\InPath;C:\Users\andarno\AppData\Local\devconsole\pkgs\DevConsole.Commandline\5.1.49;C:\Python38\Scripts\;C:\Python38\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\GitExtensions\;C:\Program Files\PowerShell\7\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\andarno\AppData\Local\CloudBuild;C:\Users\andarno\AppData\Local\CloudBuild;C:\Users\andarno\AppData\Local\Microsoft\WindowsApps;C:\Users\andarno\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\andarno\.dotnet\tools;d:\tools;C:\Program Files\Git\usr\bin;C:\Users\andarno\AppData\Roaming\npm;C:\Program Files (x86)\GitHub CLI\;C:\Users\andarno\AppData\Local\Programs\Fiddler;D:\tools\ILSpy\;C:\Users\andarno\AppData\Local\Keybase\;C:\Program Files\7-Zip;C:\Users\andarno\AppData\Local\Microsoft\WindowsApps;C:\Users\andarno\.nuget\packages\xunit.runner.console\2.4.1\tools\net472;D:\NugetCache\NetFx.SdkTools.Internal.4.6.1-1\bin;D:\VS\src\Shared\Tools\Scripts\;D:\VS\src\..\tools\Scripts\;D:\VS\src\Tools\git.extensions;D:\VS\src\tools\vstspt & %windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy bypass -Command D:\VS\.corext\DetermineIfUpdatesAreRequired.ps1 Exception calling "ResetConsolePalette" with "0" argument(s): "GetConsoleScreenBufferInfoEx->WinError: #6" At D:\users\andarno\OneDrive - Microsoft\Documents\WindowsPowerShell\Modules\PowerLine\3.1.2\PowerLine.psm1:679 char:5 + [PoshCode.Pansies.RgbColor]::ResetConsolePalette() + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : Exception Write-Host : Cannot bind parameter 'ForegroundColor'. Cannot convert value "Yellow" to type 1>EXEC : "PoshCode.Pansies.RgbColor". error : "GetConsoleScreenBufferInfoEx->WinError: #6" At D:\VS\.corext\DetermineIfUpdatesAreRequired.ps1:17 char:37 + Write-Host -ForegroundColor Yellow "CoreXT updates are requir ... + ~~~~~~ + CategoryInfo : InvalidArgument: (:) [Write-Host], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,PoshCode.Pansies.Commands.WriteHostCommand The command "Set COMPLUS_InstallRoot=& Set COMPLUS_Version=& Set PATH=C:\Users\andarno\AppData\Local\CloudBuild\quickbuild\f971769e51d0066b37ad15d2db0218b078cc6187\lib\win32\x64;D:\VS\out\gen\InPath;C:\Users\andarno\AppData\Local\devconsole\pkgs\DevConsole.Commandline\5.1.49;;D:\NugetCache\Corext.Build.2.1.5\InPath;;D:\NugetCache\RazzleBuildTools.Corext.2.2.1\x86;D:\NugetCache\VS.Tools.Roslyn.3.7.0-1.20222.2\;;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Current\bin;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Extensions\Override\etc\TaskCopy;D:\VS\src\Tools\x86\managed\v4.5;D:\VS\src\Tools\x86\managed\v4.5\tf12;D:\VS\src\Tools\x86\managed\v4.5\tf11;D:\VS\src\tools\Vctools\Dev16\build\native\..\..\lib\native\bin\Hostx86\x86;D:\VS\src\Tools\x86;D:\VS\src\Tools\perl\bin;D:\VS\src\Tools\perl\c\bin;D:\VS\src\Tools;D:\VS\src\Tools\devdiv\decatur;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;D:\VS\src\Tools\devdiv\x86\bbt\toolset;D:\VS\src\Tools\BuildCop\x86;D:\VS\src\Tools\Python;;D:\VS\src\Tools\dotnet;D:\VS\src\Tools\devdiv\internal;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;;C:\Program Files\Git\cmd;;;;;;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Path;D:\NugetCache\RazzleBuildTools.Corext.2.2.1\x86;D:\NugetCache\RazzleBuildTools.Corext.2.2.1;D:\NugetCache\VS.Tools.Roslyn.3.7.0-1.20222.2\;;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Current\bin;D:\NugetCache\.A\MsBuild.Corext.dIm6LmqcaSOpYNFOS8zl8g\Extensions\Override\etc\TaskCopy;D:\VS\src\Tools\x86\managed\v4.5;D:\VS\src\Tools\x86\managed\v4.5\tf12;D:\VS\src\Tools\x86\managed\v4.5\tf11;D:\VS\src\tools\Vctools\Dev16\build\native\..\..\lib\native\bin\Hostx86\x86;D:\VS\src\Tools\x86;D:\VS\src\Tools\perl\bin;D:\VS\src\Tools\perl\c\bin;D:\VS\src\Tools;D:\VS\src\Tools\devdiv\decatur;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;D:\VS\src\Tools\devdiv\x86\bbt\toolset;D:\VS\src\Tools\BuildCop\x86;D:\VS\src\Tools\Python;;D:\VS\src\Tools\dotnet;D:\VS\src\Tools\devdiv\internal;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;;D:\VS\src\Tools\x86\prefast\scripts;;D:\NugetCache\VS.Tools.Net.Core.SDK.x86.3.1.200-servicing-015018\;D:\VS\out\gen\InPath;C:\Users\andarno\AppData\Local\devconsole\pkgs\DevConsole.Commandline\5.1.49;C:\Python38\Scripts\;C:\Python38\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\GitExtensions\;C:\Program Files\PowerShell\7\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\andarno\AppData\Local\CloudBuild;C:\Users\andarno\AppData\Local\CloudBuild;C:\Users\andarno\AppData\Local\Microsoft\WindowsApps;C:\Users\andarno\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\andarno\.dotnet\tools;d:\tools;C:\Program Files\Git\usr\bin;C:\Users\andarno\AppData\Roaming\npm;C:\Program Files (x86)\GitHub CLI\;C:\Users\andarno\AppData\Local\Programs\Fiddler;D:\tools\ILSpy\;C:\Users\andarno\AppData\Local\Keybase\;C:\Program Files\7-Zip;C:\Users\andarno\AppData\Local\Microsoft\WindowsApps;C:\Users\andarno\.nuget\packages\xunit.runner.console\2.4.1\tools\net472;D:\NugetCache\NetFx.SdkTools.Internal.4.6.1-1\bin;D:\VS\src\Shared\Tools\Scripts\;D:\VS\src\..\tools\Scripts\;D:\VS\src\Tools\git.extensions;D:\VS\src\tools\vstspt & %windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy bypass -Command D:\VS\.corext\DetermineIfUpdatesAreRequired.ps1" exited with code 1. 1>D:\VS\QLocal\cmd\0\src\ConfigData\BuildTargets\Microsoft.DevDiv.Asserts.targets(54,5): error : One or more packages is out of date. Please run 'D:\VS\init.cmd' to update packages before building again. See http://aka.ms/dd1es-help . DetermineIfUpdatesAreRequired.ps1 output: Exception calling "ResetConsolePalette" with "0" argument(s): "GetConsoleScreenBufferInfoEx->WinError: #6";At D:\users\andarno\OneDrive - Microsoft\Documents\WindowsPowerShell\Modules\PowerLine\3.1.2\PowerLine.psm1:679 char:5;+ [PoshCode.Pansies.RgbColor]::ResetConsolePalette();+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException;+ FullyQualifiedErrorId : Exception;Write-Host : Cannot bind parameter 'ForegroundColor'. Cannot convert value "Yellow" to type;"PoshCode.Pansies.RgbColor". Error: "GetConsoleScreenBufferInfoEx->WinError: #6";At D:\VS\.corext\DetermineIfUpdatesAreRequired.ps1:17 char:37;+ Write-Host -ForegroundColor Yellow "CoreXT updates are requir ...;+ ~~~~~~;+ CategoryInfo : InvalidArgument: (:) [Write-Host], ParameterBindingException;+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,PoshCode.Pansies.Commands.WriteHostCommand. 1>Done Building Project "D:\VS\QLocal\cmd\0\src\env\shell\PackageFramework\Framework\Microsoft.VisualStudio.Shell.Framework.csproj" (Build target(s)) -- FAILED. ``` This aligns with my perception that this bug showed up at the same time I started [using powerline](https://www.hanselman.com/blog/HowToMakeAPrettyPromptInWindowsTerminalWithPowerlineNerdFontsCascadiaCodeWSLAndOhmyposh.aspx). The EXEC is a spawn of a new powershell.exe child process that then calls `ResetConsolePalette`
Author
Owner

@DHowett-MSFT commented on GitHub (May 4, 2020):

  1. That build process must pass -noprofile to powershell so that it doesn't do stuff like this. Any time a build script spawns powershell and loads the profile, a kitten joins the choir invisible.
  2. Can you share the snippet of that file that's actually calling that API?
@DHowett-MSFT commented on GitHub (May 4, 2020): 1. That build process _must_ pass `-noprofile` to powershell so that it doesn't do stuff like this. Any time a build script spawns powershell _and loads the profile_, a kitten joins the choir invisible. 2. Can you share the snippet of that file that's actually calling that API?
Author
Owner

@DHowett-MSFT commented on GitHub (May 4, 2020):

Like, there isn't even a guarantee that the build is running inside a console. This script would always always always fail in that case. Running the user's interactive session profile during a completely non-interactive build process is 100% a mistake every time.

@DHowett-MSFT commented on GitHub (May 4, 2020): Like, there isn't even a guarantee that the build is running inside a console. This script would _always always always_ fail in that case. Running the user's _interactive session profile_ during a _completely non-interactive build process_ is 100% a mistake every time.
Author
Owner

@AArnott commented on GitHub (May 4, 2020):

The line in the script that throws is here:

b3738d840e/Source/Public/Set-PowerLinePrompt.ps1 (L171)

Your prescription to add -noprofile is gold. I'll get that changed in our build right away.

@AArnott commented on GitHub (May 4, 2020): The line in the script that throws is here: https://github.com/Jaykul/PowerLine/blob/b3738d840ee67d1a4ebd0ee6436c269faffa1422/Source/Public/Set-PowerLinePrompt.ps1#L171 Your prescription to add `-noprofile` is gold. I'll get that changed in our build right away.
Author
Owner

@DHowett-MSFT commented on GitHub (May 4, 2020):

Let me know how that works! 😄

Does this definitely not repro outside of Terminal? Judging by this error chain, it will repro outside of Terminal.

@DHowett-MSFT commented on GitHub (May 4, 2020): Let me know how that works! :smile: Does this definitely not repro outside of Terminal? Judging by this error chain, it will repro outside of Terminal.
Author
Owner

@AArnott commented on GitHub (May 4, 2020):

It's possible that it repros outside of Terminal. But since adding PowerLine to my powershell profile, I never use conhost.exe because it doesn't support the unicode characters I guess that powerline is using.

@AArnott commented on GitHub (May 4, 2020): It's *possible* that it repros outside of Terminal. But since adding PowerLine to my powershell profile, I never use conhost.exe because it doesn't support the unicode characters I guess that powerline is using.
Author
Owner

@DHowett-MSFT commented on GitHub (May 4, 2020):

Worth testing! 😄

@DHowett-MSFT commented on GitHub (May 4, 2020): Worth testing! :smile:
Author
Owner

@AArnott commented on GitHub (May 8, 2020):

I've tried several times. I haven't been able to get a repro of this in conhost.exe.

@AArnott commented on GitHub (May 8, 2020): I've tried several times. I haven't been able to get a repro of this in conhost.exe.
Author
Owner

@DHowett-MSFT commented on GitHub (May 11, 2020):

Huh, that's unusual. Still, and I hate to suggest, we're doing everything in our power to make sure a console host exists to service these APIs.

At the end of the day, this profile stuff that has a dependency on those console APIs should:

  1. be made to be non-fatal
  2. be under no circumstances running during a build 😄
@DHowett-MSFT commented on GitHub (May 11, 2020): Huh, that's unusual. Still, and I hate to suggest, we're doing everything in our power to _make sure_ a console host exists to service these APIs. At the end of the day, this profile stuff that has a dependency _on_ those console APIs should: 1. _be made to be non-fatal_ 2. be under no circumstances running during a build :smile:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7847