Skip to content

powershell : Cannot process the XML from the 'Error' stream #1575

Closed

Description

@vors

Steps to reproduce

powershell -c {[console]::Error.Write('abc')} 2>&1`

Expected behavior

powershell : abc
At line:1 char:6
+ $q = powershell -c "[console]::Error.Write('abc')" 2>&1
+      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (abc:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Actual behavior

powershell : Cannot process the XML from the 'Error' stream of
'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe': Data at the root level is invalid. Line 1, position 1.
At line:1 char:1
+ powershell -c {[console]::Error.Write('abc')} 2>&1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SyntaxError: (C:\WINDOWS\Syst...\powershell.exe:String) [], XmlException
    + FullyQualifiedErrorId : ProcessStreamReader_CliXmlError

Environment data

This repros on Full Framework build and on inbox PS v5.1 on Windows.

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.14393.0
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.0
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      WindowsPowerShell
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.7-117-gbbddfe81a5a72f45e4a650cf3f42a0ca1eda86aa
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Activity

  1. added
    WG-Engine
    on Jul 29, 2016
  2. vors commented on Jul 29, 2016

    @vors
    CollaboratorAuthor

    Related. We don't handle encoding properly

    & $powershell -version 2>&1
    
    powershell.exe : M i s s i n g   a r g u m e n t   f o r   p a r a m e t e r   v e r s i o n .
    At line:1 char:1
    + & $powershell -version 2>&1
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (M i s s i n g  ... e r s i o n . :String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError
    
  3. andyleejordan commented on Aug 1, 2016

    @andyleejordan
    Member

    OH! This is related to #1524.

  4. modified the milestone: on Aug 4, 2016
  5. joeyaiello commented on May 23, 2017

    @joeyaiello
    Contributor

    This is fixed now:

    C:\Program Files\PowerShell\6.0.0-beta.1> .\powershell -c {[console]::Error.Write('abc')} 2>&1
    abc
    
  6. jszabo98 commented on May 6, 2019

    @jszabo98

    Fixed (unicode no bom)? (pwsh not powershell)

    PS C:\users\js> powershell -c {[console]::Error.Write('abc')} 2>&1
    powershell : Cannot process the XML from the 'Error' stream of 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe': Data at the root level is invalid. Line 1, position 1.
    At line:1 char:1
    + powershell -c {[console]::Error.Write('abc')} 2>&1
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SyntaxError: (C:\Windows\Syst...\powershell.exe:String) [], XmlException
    + FullyQualifiedErrorId : ProcessStreamReader_CliXmlError
    
    PS C:\users\js> pwsh -c {[console]::Error.Write('abc')} 2>&1
    abc
    
    PS C:\users\js> $PSVersionTable
    
    Name                           Value
    ----                           -----
    PSVersion                      6.1.2
    PSEdition                      Core
    GitCommitId                    6.1.2
    OS                             Microsoft Windows 10.0.16299
    Platform                       Win32NT
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1
    WSManStackVersion              3.0
  7. vors commented on Jun 15, 2019

    @vors
    CollaboratorAuthor

    Doesn't repro for me on 7.0.0-beta1 on mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-WindowsResolution-FixedWG-Engine

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions