-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management moduleWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
Description
Perhaps surprisingly, using -Name decorates the strings being output with NoteProperty members from the underlying PS provider, such as .PSPath, just as with the default output types (e.g., System.IO.FileInfo / System.IO.DirectoryInfo for the filesystem provider).
However, this currently happens inconsistently, namely only if -Recurse isn't also specified.
As an aside: providing a way to opt out of this decoration (-Raw) may be helpful for performance reasons; see also: #9119
Steps to reproduce
Run the following Pester test:
Describe "Get-ChildItem -Name provider-properties test" {
It "-Name adds provider properties" {
Get-ChildItem / -Name | Select-Object -First 1 | Get-Member -Name PSPath | Should -Not -BeNullOrEmpty
}
It "-Name -Recurse adds provider properties too" {
Get-ChildItem / -Name -Recurse | Select-Object -First 1 | Get-Member -Name PSPath | Should -Not -BeNullOrEmpty
}
}
Expected behavior
Both tests should pass.
Actual behavior
Executing script ....Tests.ps1
Describing Get-ChildItem -Name provider-properties test
[+] -Name adds provider properties 612ms
[-] -Name -Recurse adds provider properties too 156ms
Expected a value, but got $null or empty.
6: Get-ChildItem / -Name -Recurse | Select-Object -First 1 | Get-Member -Name PSPath | Should -Not -BeNullOrEmpty
at <ScriptBlock>, ....Tests.ps1: line 6
Environment data
PowerShell Core 6.2.0-preview.4
Windows PowerShell v5.1.17134.407
Metadata
Metadata
Assignees
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management moduleWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.