Title: Write-Output -NoEnumerate outputs PSObject[] rather than Object[] and generally doesn't respect the input collection type · Issue #5955 · PowerShell/PowerShell · GitHub
Open Graph Title: Write-Output -NoEnumerate outputs PSObject[] rather than Object[] and generally doesn't respect the input collection type · Issue #5955 · PowerShell/PowerShell
X Title: Write-Output -NoEnumerate outputs PSObject[] rather than Object[] and generally doesn't respect the input collection type · Issue #5955 · PowerShell/PowerShell
Description: Related: #5122 Write-Output -NoEnumerate, when given a collection, always returns a PSObject[] rather than a regular object[]] array, which is unexpected. Additionally, this means that if a different collection type such as [System.Colle...
Open Graph Description: Related: #5122 Write-Output -NoEnumerate, when given a collection, always returns a PSObject[] rather than a regular object[]] array, which is unexpected. Additionally, this means that if a differe...
X Description: Related: #5122 Write-Output -NoEnumerate, when given a collection, always returns a PSObject[] rather than a regular object[]] array, which is unexpected. Additionally, this means that if a differe...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/5955
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Write-Output -NoEnumerate outputs PSObject[] rather than Object[] and generally doesn't respect the input collection type","articleBody":"\u003csup>Related: #5122\u003c/sup>\r\n\r\n* `Write-Output -NoEnumerate`, when given a collection, always returns a `PSObject[]` rather than a regular `object[]]` array, which is unexpected.\r\n\r\n* Additionally, this means that if a different collection type such as `[System.Collections.ArrayList]` was passed, it is _not_ preserved.\r\n * [`Write-Output`'s documentation](https://github.com/PowerShell/PowerShell-Docs/blob/staging/reference/6/Microsoft.PowerShell.Utility/Write-Output.md), 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.\r\n\r\nI suspect this regression is a consequence of the ill-fated #2038 PR that arose out of issue #2035.\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```powershell\r\n(Write-Output -NoEnumerate 1, 2).GetType().Name\r\n(Write-Output -NoEnumerate ([System.Collections.ArrayList] (1, 2))).GetType().Name\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\n```none\r\nObject[]\r\nArrayList\r\n```\r\n\r\nThis is how it still works in _Windows PowerShell_ v5.1\r\n\r\nActual behavior\r\n---------------\r\n\r\n```none\r\nPSObject[]\r\nPSObject[]\r\n```\r\n\r\nAs stated, this affects PS _Core_ only.\r\n\r\nEnvironment data\r\n----------------\r\n\r\n```powershell\r\nPowerShell Core v6.0.0 on macOS 10.13.2\r\nPowerShell Core v6.0.0 on Ubuntu 16.04.3 LTS\r\nPowerShell Core v6.0.0 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2018-01-19T19:32:47Z","url":"https://github.com/PowerShell/PowerShell/issues/5955"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:29bf8bcd-56f3-e935-38d6-87e76bd817a8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D430:19658F:1479BA:1D28AD:6AFD5CB8 |
| html-safe-nonce | 2400c0afe21f35088e4f4d155af65ebbf46cfe316227e35f5c15c565bbc5051e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENDMwOjE5NjU4RjoxNDc5QkE6MUQyOEFEOjZBRkQ1Q0I4IiwidmlzaXRvcl9pZCI6IjgzNDc1MjYzNTUxMTU5NDE2OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3e18a326c17245aba53c50857eae8b613bbade342a1943d1bdc7ee248093fb21 |
| hovercard-subject-tag | issue:290083213 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/5955/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1c01a7e747b6a73e30340678989fa018e6c5e2f8c8b581cf66934286b2d97414/PowerShell/PowerShell/issues/5955 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1c01a7e747b6a73e30340678989fa018e6c5e2f8c8b581cf66934286b2d97414/PowerShell/PowerShell/issues/5955 |
| og:image:alt | Related: #5122 Write-Output -NoEnumerate, when given a collection, always returns a PSObject[] rather than a regular object[]] array, which is unexpected. Additionally, this means that if a differe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width