Repository navigation
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
FYI - I have a workaround for this 🎉 - but still digging into the why this actually happens
I've narrowed this down from where I had seen this whilst building PowerShell running in conhost.
This doesn't replicate in Windows Terminal, haven't tried this in other hosts.
Repro 1 - Pipeline to Write-Verbose in Start-ResGen in build.psm1
This was via running Start-PSBuild, which calls Start-ResGen and this calls Start-NativeExecution which calls dotnet run and pipes to Write-Verbose
Note Changing to Write-Debug also shows
Lines 3265 to 3286 in c839d89
| function Start-ResGen | |
| { | |
| <# | |
| .SYNOPSIS | |
| Regenerates C# resource bindings from resx files. | |
| .DESCRIPTION | |
| Runs the ResGen .NET tool in src/ResGen to produce strongly-typed resource classes | |
| for all resx files in the PowerShell project. | |
| #> | |
| [CmdletBinding()] | |
| param() | |
| # Add .NET CLI tools to PATH | |
| Find-Dotnet | |
| Push-Location "$PSScriptRoot/src/ResGen" | |
| try { | |
| Start-NativeExecution { dotnet run } | Write-Verbose | |
| } finally { | |
| Pop-Location | |
| } | |
| } |
Repro 2
cmd /c echo hello | Write-Verbose -Verbose
cmd /c echo hello | Write-Debug -Debug -warn # literally anything that forces error formatting
cmd /c echo hello | Write-Debug -Debug
Repro 3 - Console.WriteLine in console app
Create a console app that does this
using System;
using System.Management.Automation;
class Program
{
static void Main()
{
Console.WriteLine("SomeTextThatShouldShowUpInTheOutput");
}
}Build that and then call it like so
. C:\ps\PS-dll-consoleApp\ConsoleToVerbose\bin\Debug\net11.0\ConsoleToVerbose.exe) | Write-Verbose -VerboseExpected behavior
Proper wrapping & display of formatting like is done elsewhereActual behavior
It doesn't wrap properlyError details
Environment data
Name Value
---- -----
PSVersion 7.6.10
PSEdition Core
GitCommitId 7.6.10
OS Microsoft Windows 10.0.26300
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
Start-PSBuild -Output "$pwd-out-ParamSets" -Restore -PSModuleRestore -UseNuGetOrg -Detailed -Clean -Verbose
As above but comment out
| Write-Verbosein Start-ResGen from build.psm1 intry {Start-NativeExecution { dotnet run } | Write-Verbose }
As above but change
| Write-Verbosein Start-ResGen from build.psm1 to| Write-Debug
Same but instead of calling Start-NativeExecution wrap
(dotnet run) | Write-Verbose
Confirmed with wrapped console app
Workaround
Wrap calls to executables that use Standard Output & you want this expressed in another stream like so
(. C:\ps\PS-dll-consoleApp\ConsoleToVerbose\bin\Debug\net11.0\ConsoleToVerbose.exe) | Write-Verbose -Verbose
Activity
mklement0 commentedon Nov 19, 2026
This is a long-standing problem first reported in 2022: