(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
(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
Expected behavior
The code above works and prints something like
Actual behavior
Formatting of the error (
$_ | Out-String) failsIn the above,
$err.ErrorCategory_Messagelooks strange. Should it be$err.ErrorCategory.Messageperhaps (.instead of_)?Environment data