Skip to content

Get-Error populates $Error variable #11228

Closed

Description

Steps to reproduce

Open a new pwsh

$Error
Get-Process blah

$Error

Get-Error

$Error

Expected behavior


$Error # no output expected
Get-Process blah

$Error # previous and only one error in output

Get-Error # gets the previous error in detailed error output

$Error # only one error in output expected

Actual behavior

$Error # no output expected
Get-Process blah

$Error # previous and only one error in output

Get-Error # gets the previous error in detailed error output

$Error # actual error and Get-Error output both captured in this variable

Environment data


Name                           Value
----                           -----
PSVersion                      7.0.0-preview.6
PSEdition                      Core
GitCommitId                    7.0.0-preview.6
OS                             Microsoft Windows 10.0.19033
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

  1. added
    Issue-Question
    on Dec 1, 2019
  2. iSazonov commented on Dec 1, 2019

    @iSazonov
    Collaborator

    It was fixed in #11125.
    I don't know why it is not in Preview6 /cc Steve Lee (@SteveL-MSFT)

  3. kvprasoon commented on Dec 2, 2019

    @kvprasoon
    ContributorAuthor

    Ilya (@iSazonov) did you try this ? I got it in P.6

  4. vexx32 commented on Dec 2, 2019

    @vexx32
    Collaborator

    Looks like Steve Lee (@SteveL-MSFT)'s fix is still causing the error to be caught and stored in $error when Get-Error duplicates it to avoid modifying the original error object, which seems undesirable.

  5. iSazonov commented on Dec 2, 2019

    @iSazonov
    Collaborator

    PRASOON KARUNAN V (@kvprasoon) I can not repo with latest (post Preview6) build.

  6. vexx32 commented on Dec 2, 2019

    @vexx32
    Collaborator

    Ah, that'll be why I'm not seeing it, then. Missed that detail, cheers!

  7. iSazonov commented on Dec 2, 2019

    @iSazonov
    Collaborator

    I seems we are not accurate in setting milestones :-(

  8. ghost closed this as completedon Dec 3, 2019
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

    Issue-QuestionResolution-Fixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions