Skip to content

v7.0.0-rc.1 regression - error on error formatting with strict mode and $ErrorView = 'NormalView' #11371

@nightroman

Description

@nightroman

(UPDATE: I keep the original post but the problem is easier to reproduce, see further comments)

v7.0.0-rc.1 regression - error on error formatting with strict mode and default host

Steps to reproduce

# v6-rc: fixed
# v7.0.0-rc.1: fails "The property 'ErrorCategory_Message' cannot be found on this object."

[PowerShell]::Create().AddScript({
    $ErrorView = 'NormalView' #! v7
    Set-StrictMode -Version 2
    try {
        throw 'Oops!'
    }
    catch {
        'Error {'
        $_ | Out-String
        '}'
        $Error[0]
    }
}).Invoke()

Expected behavior

The code above works and prints something like

Error {
    Oops! ...
}
Oops! ...

Actual behavior

Formatting of the error ($_ | Out-String) fails

Error {


}

PropertyNotFoundException:
Line |
 231 |                                         $errorCategoryMsg = $err.ErrorCategory_Message

     |                                         ^ The property 'ErrorCategory_Message' cannot be found on this object. Verify that the property exists.

In the above, $err.ErrorCategory_Message looks strange. Should it be $err.ErrorCategory.Message perhaps (. instead of _)?

Environment data

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

Metadata

Metadata

Assignees

Labels

Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtime

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions