Steps to reproduce
Note: (& {}) is used to produce AutomationNull, i.e. the [System.Management.Automation.Internal.AutomationNull]::Value singleton representing "no output" in PowerShell.
$automationNull = & {}
1, $automationNull, 2, $automationNull, 3, 4, 5 | ForEach-Object { $_ } | Should -Be (1..5)
Expected behavior
The test should pass: all non-AutomationNull values should be passed through (while the AutomationNull values in the input are apparently themselves not sent through the pipeline).
Actual behavior
The test fails, because enumeration unexpectedly stops on encountering the second non-AutomationNull value.
Expected @(1, 2, 3, 4, 5), but got @(1, 2).
Note that using true $null values does not exhibit the problem: the following test succeeds:
1, $null, 2, $null, 3, 4, 5 | ForEach-Object { $_ } | Should -Be 1, $null, 2, $null, 3, 4, 5 # OK
Environment data
PowerShell Core 7.2.0-preview.3
Steps to reproduce
Note:
(& {})is used to produce AutomationNull, i.e. the[System.Management.Automation.Internal.AutomationNull]::Valuesingleton representing "no output" in PowerShell.Expected behavior
The test should pass: all non-AutomationNull values should be passed through (while the AutomationNull values in the input are apparently themselves not sent through the pipeline).
Actual behavior
The test fails, because enumeration unexpectedly stops on encountering the second non-AutomationNull value.
Note that using true
$nullvalues does not exhibit the problem: the following test succeeds:Environment data