And exceptions fail to display at all.
Steps to reproduce
Don't execute these in one single invocation; each line should be entered separately at the interactive prompt:
if foo
$error
$error.Count
$foo = $error[-1]
$foo
$error.Count
Expected behavior
The first line should yield an error, because "if foo" is not valid syntax. And then when we execute "$error" we should see the contents of the $error variable, which should be that same error. And then $error.Count should yield "1". And then when we assign that error into $foo, and then output $foo, we should see the error again. And $error.Count should stay 1.
Actual behavior
When $error is output, we get
InvalidOperation: An error occurred while enumerating through a collection: Collection was modified; enumeration operation may not execute..
And $error.Count is 4, not 1.
And then when we output $foo, get get... nothing. (well, a blank line)
And then $error.Count is 6.
Environment data
Name Value
---- -----
PSVersion 7.0.0-rc.1
PSEdition Core
GitCommitId 7.0.0-rc.1
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
And exceptions fail to display at all.
Steps to reproduce
Don't execute these in one single invocation; each line should be entered separately at the interactive prompt:
Expected behavior
The first line should yield an error, because "
if foo" is not valid syntax. And then when we execute "$error" we should see the contents of the$errorvariable, which should be that same error. And then$error.Countshould yield "1". And then when we assign that error into$foo, and then output$foo, we should see the error again. And$error.Countshould stay 1.Actual behavior
When
$erroris output, we getAnd
$error.Countis 4, not 1.And then when we output
$foo, get get... nothing. (well, a blank line)And then $error.Count is 6.
Environment data