Skip to content

Problems with enabling Virtual Terminal Mode when streaming program output on conhost #19813

@Herrmel

Description

@Herrmel

Prerequisites

Steps to reproduce

On PowerShell with conhost use the following Command:

dotnet --version | Write-Verbose -Verbose

If dotnet is not installed you can also use cmd /c ver or any other programm.

Expected behavior

Printing the following output in yellow:

VERBOSE: 7.0.100

Actual behavior

The following Text is printed colorless:

�[33;1mVERBOSE: 7.0.100�[0m

Error details

For some very odd reason after I type an incorrect parameter like this:

dotnet --version | Write-Verbose -u # -u does not exist

The error-message is again displayed with ansi escape signs:

←[31;1mWrite-Verbose: ←[31;1mA parameter cannot be found that matches parameter name 'u'.←[0m

But after this the previous example works as expected (See image below).

When the text is not streamed for example when intercepting the output with out-string (without the -Stream parameter) it also works.

I already had an issue for this in #18771 wich got blamed on the terminal repo and closed without any investigation. In my opinion this must be an issue with powershell because:

  1. It worked in older 7.2.x versions
  2. It randomly works after a runtime error
  3. The terminal guy thinks so aswell

We provide powershell commands with our program and it really sucks to explain to every customer that we can't fix this and that they have to install an older version or another terminal to fix this.

Also some other items that seem related:
#16612
#18294
#19425



### Environment data

```powershell
Name                           Value
----                           -----
PSVersion                      7.3.0
PSEdition                      Core
GitCommitId                    7.3.0
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Also tested with 7.3.4 and 7.4.0-preview.3

Visuals

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.Resolution-ExternalThe issue is caused by external component(s).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions