pre-#2038 Write-Output: {Write-Output @() -NoEnumerate}.Invoke() returns empty Collection<PSObject> #7081
Labels
Issue-Discussion
the issue may not have a clear classification yet. The issue may generate an RFC or may be reclassif
Resolution-No Activity
Issue has had no activity for 6 months or more
WG-Cmdlets-Utility
cmdlets in the Microsoft.PowerShell.Utility module
The behavior of
Write-Output
has been incorrect since #2038 (see #5955, #5122, #6451, etc.). I'd like for its correct behavior to be restored. It seems like restoringWrite-Output
to its pre-#2038 implementation wouldn't be entirely sufficient, however. It seems like there's something that changed between version 5.1 and 6.1-preview that affects how the pre-#2038 implementation ofWrite-Output
behave for empty arrays. That is why I'm opening this issue.For this repro I've implemented
Write-Output2
as a stand-in for pre-#2038Write-Output
(see #6451(comment)) . I believe (and it is my intention) that this implementation ofWrite-Output2
matches the pre-#2038 implementation ofWrite-Output
.Steps to reproduce
Expected behavior
I expected the
Collection<PSObject>
returned by.Invoke()
to contain a reference to the empty array passed toWrite-Output2
. I expected thatWrite-Output -NoEnumerate
should be transparent to the object passed to it. Such behavior would match the behavior in version 5.1.Actual behavior
The
Collection<PSObject>
does not contain anything.Environment data
The text was updated successfully, but these errors were encountered: