Repository navigation
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
Description
I'm not sure which behavior is better, but I expected 5.1 and 6.0 to behave the same in this respect. If this change is deliberate I would like to understand why.
Steps to reproduce
$r = [System.Collections.ObjectModel.Collection[psobject]]{Write-Output $null -NoEnumerate}.Invoke()
$r.item(0).GetType()Behavior in PowerShell 5.1
You cannot call a method on a null-valued expression.
At C:\Users\un1\Desktop\test.ps1:2 char:1
+ $r[0].GetType()
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
>$PSVersionTable
Name Value
---- -----
PSVersion 5.1.14409.1012
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1012
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1 Behavior in PowerShell 6.0
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True PSObject[] System.Array
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.2
PSEdition Core
GitCommitId v6.0.2
OS Microsoft Windows 6.3.9600
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0 Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
Activity
mklement0 commentedon Mar 21, 2018
Indeed,
Write-Outputis broken - see #5955 and #5122, and it all seems to be the result of the ill-fated #2038 PR that arose out of issue #2035.alx9r commentedon Mar 21, 2018
Oi. That's a messy broken business, indeed.
alx9r commentedon Mar 21, 2018
It looks like this change to Write-Output is the culprit. Copying the command from the revision prior and renaming to
Write-Output2seems to result in behavior consistent with PowerShell 5.1:outputs
Fix accidental wrapping of scalar Write-Output input
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.