René's URL Explorer Experiment


Title: Property-based pipeline-parameter binding should be applied to argument-based parameter binding as well · Issue #6057 · PowerShell/PowerShell · GitHub

Open Graph Title: Property-based pipeline-parameter binding should be applied to argument-based parameter binding as well · Issue #6057 · PowerShell/PowerShell

X Title: Property-based pipeline-parameter binding should be applied to argument-based parameter binding as well · Issue #6057 · PowerShell/PowerShell

Description: Note: Fixing this would be a breaking change, but arguably one that falls into Bucket 3: Unlikely Grey Area. Currently, when you use a ValueFromPipelineByPropertyName parameter attribute, the property named there is only bound when using...

Open Graph Description: Note: Fixing this would be a breaking change, but arguably one that falls into Bucket 3: Unlikely Grey Area. Currently, when you use a ValueFromPipelineByPropertyName parameter attribute, the prope...

X Description: Note: Fixing this would be a breaking change, but arguably one that falls into Bucket 3: Unlikely Grey Area. Currently, when you use a ValueFromPipelineByPropertyName parameter attribute, the prope...

Opengraph URL: https://github.com/PowerShell/PowerShell/issues/6057

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Property-based pipeline-parameter binding should be applied to argument-based parameter binding as well","articleBody":"Note: Fixing this would be a breaking change, but arguably one that falls into [Bucket 3: Unlikely Grey Area](https://github.com/PowerShell/PowerShell/blob/master/docs/dev-process/breaking-change-contract.md#bucket-3-unlikely-grey-area).\r\n\r\n**Currently, when you use a `ValueFromPipelineByPropertyName` parameter attribute, the property named there is only bound when using _pipeline_ input and not also when passing the same object as a direct _argument_.**\r\n\r\nTo illustrate the discrepancy with a simple example:\r\n\r\n```powershell\r\n# Declare a function with a parameter that binds pipeline input by the value of \r\n# property .LiteralPath or its alias .PSPath\r\nfunction foo { \r\n  param(\r\n   [Parameter(ValueFromPipelineByPropertyName)]\r\n   [Alias('PSPath')]\r\n   [string[]] ${LiteralPath}\r\n  ) \r\n  \"`$LiteralPath: [$LiteralPath]\" \r\n}\r\n\r\n# Create object with a .PSPath property.\r\n$obj = [pscustomobject] @{ PSPath = 'pspath' }\r\n\r\n# Pass the object to the function, first via the pipeline, then as a direct argument\r\n$obj | foo\r\nfoo -LiteralPath $obj\r\n```\r\n\r\nThe output shows that the `.PSPath` property is bound es expected via the pipeline, but _not_ as a direct argument:\r\n\r\n```none\r\n$LiteralPath: [pspath]                       # OK (pipeline): .PsPath value was bound.\r\n$LiteralPath: [@{PSPath=pspath}]  # !! (argument): $obj was simply stringified (.ToString())\r\n```\r\n\r\nThe **binding of the direct _argument_ pays attention only to the parameter _type_**, causing it to simply _stringify_ `$obj` with `.ToString()` (not with default output formatting).\r\n\r\nThis discrepancy is not only surprising, it **can have grave consequences** when dealing with `[System.IO.FileInfo]` instances output by **`Get-ChildItem`**,  because the latter **often stringify to a _mere filename_**, potentially causing unexpected and destructive behavior with `-LiteralPath` cmdlets such as `Remove-Item`, `Move-Item` and `Copy-Item`:\r\n\r\n```powershell\r\n# Create sample file 'tmpFile' in subfolder 'tmpDir'; i.e.: tmpDir/tmpFile\r\n$null > (Join-Path (New-Item -force -Type Directory tmpDir) tmpFile)\r\n\r\n# Obtain a [System.IO.FileInfo] instance representing the new file.\r\n# Note that `Get-ChildItem tmpDir` rather than `Get-Item tmpDir/tmpFile` (or\r\n# `Get-ChildItem tmpDir/tmpFile` is purposely used, because it is only\r\n# `Get-ChildItem` without a filename component in the path that stringifies \r\n#  the resulting instances to their filename only.\r\n$f = Get-ChildItem tmpDir\r\n\r\n# Demonstrate that $f stringies to just 'tmpFile' - the mere filename.\r\n\"`$f stringifies to: [$f]\"\r\n\r\n# Now bind $f to the -LiteralPath parameter as a *direct argument* of \r\n# several cmdlets, which *fails*, because trying to locate the input object\r\n# as a *string* that is the *filename only* fails, given that file is in\r\n# a *subdirectory*.\r\nRemove-Item -WhatIf -LiteralPath $f\r\nMove-Item -WhatIf -LiteralPath $f foo\r\nCopy-Item -WhatIf -LiteralPath $f foo\r\n```\r\n\r\nThe last 3 calls fail unexpectedly; while this happens not to be destructive / make unexpected changes in this example, it would be the case if namesake files happened to exist in the current location.\r\n\r\n**The fact that whether this problem arises depends on the specific method through which the `[System.IO.FileInfo]`, `[System.IO.DirectoryInfo]` instances were obtained makes this behavior particularly insidious.**\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\nWindows PowerShell v5.1.15063.674 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-28T23:31:54Z","url":"https://github.com/PowerShell/PowerShell/issues/6057"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:d9c17789-7ec0-14c0-409a-b231ca0ad52c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE890:3676C:31CD8C:44E2F6:6AFDA393
html-safe-noncecc2dd7dfbf2f9313f67f730b54a64eed3ff67f8f2af6d886c3970915fd32181f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODkwOjM2NzZDOjMxQ0Q4Qzo0NEUyRjY6NkFGREEzOTMiLCJ2aXNpdG9yX2lkIjoiMTI3MjY3OTA5MzEyODUwNDIxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac7c0add1716804e19c91d251fd98256b5fa9229378441cbb64b1169bce8f986f7
hovercard-subject-tagissue:292250255
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/6057/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d55ea2fb8cffb6a4c078e65e03004e2d79d8a85b58c1ce4558a7694813c6620a/PowerShell/PowerShell/issues/6057
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d55ea2fb8cffb6a4c078e65e03004e2d79d8a85b58c1ce4558a7694813c6620a/PowerShell/PowerShell/issues/6057
og:image:altNote: Fixing this would be a breaking change, but arguably one that falls into Bucket 3: Unlikely Grey Area. Currently, when you use a ValueFromPipelineByPropertyName parameter attribute, the prope...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemklement0
hostnamegithub.com
expected-hostnamegithub.com
Nonebc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea
turbo-cache-controlno-preview
go-importgithub.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id49609581
octolytics-dimension-repository_nwoPowerShell/PowerShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49609581
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShell
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release0ddf53eb35c87f1f8df13dbf75c3bdadbfc6e969
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/PowerShell/PowerShell/issues/6057#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F6057
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F6057
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=PowerShell%2FPowerShell
Reloadhttps://github.com/PowerShell/PowerShell/issues/6057
Reloadhttps://github.com/PowerShell/PowerShell/issues/6057
Reloadhttps://github.com/PowerShell/PowerShell/issues/6057
PowerShellhttps://github.com/PowerShell
PowerShellhttps://github.com/PowerShell/PowerShell
Codehttps://github.com/PowerShell/PowerShell
Issues1.3k (1.3k)https://github.com/PowerShell/PowerShell/issues
Pull requests366 (366)https://github.com/PowerShell/PowerShell/pulls
Discussionshttps://github.com/PowerShell/PowerShell/discussions
Actionshttps://github.com/PowerShell/PowerShell/actions
Projectshttps://github.com/PowerShell/PowerShell/projects
Security and quality3 (3)https://github.com/PowerShell/PowerShell/security
Insightshttps://github.com/PowerShell/PowerShell/insights
https://github.com/PowerShell/PowerShell
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/6057
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/6057
Property-based pipeline-parameter binding should be applied to argument-based parameter binding as wellhttps://github.com/PowerShell/PowerShell/issues/6057#top
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Discussion%22
Resolution-No ActivityIssue has had no activity for 6 months or morehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-No%20Activity%22
WG-Cmdletsgeneral cmdlet issueshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Cmdlets%22
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Jan 28, 2018https://github.com/PowerShell/PowerShell/issues/6057#issue-292250255
Bucket 3: Unlikely Grey Areahttps://github.com/PowerShell/PowerShell/blob/master/docs/dev-process/breaking-change-contract.md#bucket-3-unlikely-grey-area
https://github.com/iSazonov
Ilya (iSazonov)https://github.com/iSazonov
on Jan 29, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-361186165
Ilya (iSazonov)https://github.com/iSazonov
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Discussion%22
Area-Cmdlets-Corehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Area-Cmdlets-Core%22
on Jan 29, 2018https://github.com/PowerShell/PowerShell/issues/6057#event-1445886898
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Jan 29, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-361374748
Ilya (@iSazonov)https://github.com/iSazonov
https://github.com/iSazonov
Ilya (iSazonov)https://github.com/iSazonov
on Jan 30, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-361477801
#5789https://github.com/PowerShell/PowerShell/issues/5789
https://github.com/powercode
Staffan Gustafsson (powercode)https://github.com/powercode
on Jan 30, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-361548950
https://github.com/iSazonov
Ilya (iSazonov)https://github.com/iSazonov
on Jan 30, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-361578799
https://github.com/powercode
Staffan Gustafsson (powercode)https://github.com/powercode
on Jan 30, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-361586113
Ilya (@iSazonov)https://github.com/iSazonov
https://github.com/iSazonov
Ilya (iSazonov)https://github.com/iSazonov
on Jan 30, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-361614371
#5789https://github.com/PowerShell/PowerShell/issues/5789
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Jan 31, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-362094962
Staffan Gustafsson (@powercode)https://github.com/powercode
Ilya (@iSazonov)https://github.com/iSazonov
Directly constructed .NET type instances lack properties that ones output by cmdlets have #4347https://github.com/PowerShell/PowerShell/issues/4347
https://github.com/iSazonov
Ilya (iSazonov)https://github.com/iSazonov
on Feb 5, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-363119541
File enumeration extensibilityhttps://github.com/dotnet/corefx/pull/26806
https://github.com/BrucePay
Bruce Payette (BrucePay)https://github.com/BrucePay
on Jun 19, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-398580724
https://github.com/iSazonov
Ilya (iSazonov)https://github.com/iSazonov
on Jun 20, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-398623125
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Jun 21, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-399159974
Bruce Payette (@BrucePay)https://github.com/BrucePay
Ilya (@iSazonov)https://github.com/iSazonov
#7132https://github.com/PowerShell/PowerShell/issues/7132
https://github.com/BrucePay
Bruce Payette (BrucePay)https://github.com/BrucePay
on Jun 22, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-399286074
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Jun 22, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-399298728
Bruce Payette (@BrucePay)https://github.com/BrucePay
https://github.com/iSazonov
Ilya (iSazonov)https://github.com/iSazonov
on Jun 22, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-399326724
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Jun 25, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-400107991
https://github.com/iSazonov
Ilya (iSazonov)https://github.com/iSazonov
on Jun 26, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-400182023
Michael Klement (@mklement0)https://github.com/mklement0
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Jun 26, 2018https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-400289060
Ilya (@iSazonov)https://github.com/iSazonov
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-1813990810
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-1813990815
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
Resolution-No ActivityIssue has had no activity for 6 months or morehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-No%20Activity%22
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/6057#event-10977377807
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-1814001468
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 23, 2023https://github.com/PowerShell/PowerShell/issues/6057#issuecomment-1824444379
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
completedhttps://github.com/PowerShell/PowerShell/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Nov 23, 2023https://github.com/PowerShell/PowerShell/issues/6057#event-11047776012
Ryan Yates (kilasuit)https://github.com/kilasuit
WG-Cmdletsgeneral cmdlet issueshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Cmdlets%22
WG-Cmdlets-Corehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Cmdlets-Core%22
on Jul 17, 2026https://github.com/PowerShell/PowerShell/issues/6057#event-28145218069
Sign up for freehttps://github.com/signup?return_to=https://github.com/PowerShell/PowerShell/issues/6057
Sign in to commenthttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/6057
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Discussion%22
Resolution-No ActivityIssue has had no activity for 6 months or morehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-No%20Activity%22
WG-Cmdletsgeneral cmdlet issueshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Cmdlets%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.