New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write-Output -NoEnumerate outputs PSObject[] rather than Object[] and generally doesn't respect the input collection type #5955
Comments
If it is a regression - it is a bug. |
when -NoEnumerate is used. Fix PowerShell#5122
How has this been allowed to continue for this long? |
@Jaykul Fixing this now. After a longer-than-necessary foray into the pipeline files, it turns out that typing your parameters as |
Related: #5122
Write-Output -NoEnumerate
, when given a collection, always returns aPSObject[]
rather than a regularobject[]]
array, which is unexpected.Additionally, this means that if a different collection type such as
[System.Collections.ArrayList]
was passed, it is not preserved.Write-Output
's documentation, which currently only states, "prevents Write-Output from enumerating output", which sounds like the input collection - whatever its type - is simply passed through - a sensible expectation that Windows PowerShell versions up to v5.1 indeed honor.I suspect this regression is a consequence of the ill-fated #2038 PR that arose out of issue #2035.
Steps to reproduce
Expected behavior
This is how it still works in Windows PowerShell v5.1
Actual behavior
As stated, this affects PS Core only.
Environment data
The text was updated successfully, but these errors were encountered: