René's URL Explorer Experiment


Title: Parameter binding problem with ValueFromRemainingArguments in PS functions · Issue #2035 · PowerShell/PowerShell · GitHub

Open Graph Title: Parameter binding problem with ValueFromRemainingArguments in PS functions · Issue #2035 · PowerShell/PowerShell

X Title: Parameter binding problem with ValueFromRemainingArguments in PS functions · Issue #2035 · PowerShell/PowerShell

Description: Steps to reproduce Define a PowerShell function with an array parameter using the ValueFromRemainingArguments property of the Parameter attribute. Instead of sending multiple arguments, send that parameter a single array argument. & { pa...

Open Graph Description: Steps to reproduce Define a PowerShell function with an array parameter using the ValueFromRemainingArguments property of the Parameter attribute. Instead of sending multiple arguments, send that p...

X Description: Steps to reproduce Define a PowerShell function with an array parameter using the ValueFromRemainingArguments property of the Parameter attribute. Instead of sending multiple arguments, send that p...

Mail addresses
notifications@github.com

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Parameter binding problem with ValueFromRemainingArguments in PS functions","articleBody":"## Steps to reproduce\n\nDefine a PowerShell function with an array parameter using the ValueFromRemainingArguments property of the Parameter attribute.  Instead of sending multiple arguments, send that parameter a single array argument.\n\n``` posh\n & {\n     param(\n         [string]\n         [Parameter(Position=0)]\n         $Root,\n\n         [string[]]\n         [Parameter(Position=1, ValueFromRemainingArguments)]\n         $Extra)\n     $Extra.Count;\n     for ($i = 0; $i -lt $Extra.Count; $i++)\n     {\n        \"${i}: $($Extra[$i])\"\n     }\n } root aa,bb\n```\n## Expected behavior\n\nThe array should be bound to the parameter just as you sent it, the same way it works for cmdlets.  (The \"ValueFromRemainingArguments\" behavior isn't used, in this case, it should just bind like any other array parameter type.)  The output of the above script block should be:\n\n2\n0: aa\n1: bb\n## Actual behavior\n\nPowerShell appears to be performing type conversion on the argument to treat the array as a single element of the parameter's array, instead of checking first to see if more arguments will be bound as \"remaining arguments\" first.  The output of the above script block is currently:\n\n1\n0: aa bb\n## Additional information\n\nTo demonstrate that the behavior of cmdlets is different, you can use this code:\n\n``` posh\nAdd-Type -OutputAssembly $env:temp\\testBinding.dll -TypeDefinition @'\n    using System;\n    using System.Management.Automation;\n\n    [Cmdlet(\"Test\", \"Binding\")]\n    public class TestBindingCommand : PSCmdlet\n    {\n        [Parameter(Position = 0)]\n        public string Root { get; set; }\n\n        [Parameter(Position = 1, ValueFromRemainingArguments = true)]\n        public string[] Extra { get; set; }\n\n        protected override void ProcessRecord()\n        {\n            WriteObject(Extra.Length);\n            for (int i = 0; i \u003c Extra.Length; i++)\n            {\n                WriteObject(String.Format(\"{0}: {1}\", i, Extra[i]));\n            }\n        }\n    }\n'@\n\nImport-Module $env:temp\\testBinding.dll\n\nTest-Binding root aa,bb\n```\n## Environment data\n\n\u003c!-- provide the output of $PSVersionTable -->\n\n``` powershell\n> $PSVersionTable\nName                           Value\n----                           -----\nPSEdition                      Core\nPSVersion                      6.0.0-alpha\nPSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}\nWSManStackVersion              3.0\nGitCommitId                    v6.0.0-alpha.9-107-g203ace04c09dbbc1ac00d6b497849cb69cc919fb-dirty\nPSRemotingProtocolVersion      2.3\nCLRVersion\nSerializationVersion           1.1.0.1\nBuildVersion                   3.0.0.0\n```\n","author":{"url":"https://github.com/dlwyatt","@type":"Person","name":"dlwyatt"},"datePublished":"2016-08-23T15:51:55Z","url":"https://github.com/PowerShell/PowerShell/issues/2035"}

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:2b15c88a-95b8-2e53-8389-ac695adfe7fc
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB3C8:2A3251:10ED28:180E3F:6AFD5DAE
html-safe-nonce33f0afd464f5fc1f5e689404df6709f68fa926a36b7c5e8e65d9e29d05594aab
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCM0M4OjJBMzI1MToxMEVEMjg6MTgwRTNGOjZBRkQ1REFFIiwidmlzaXRvcl9pZCI6IjE0NTcwNzg2MjYzMDk0NjM0NzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac37d48e05c8d600c3be74423b504c27035cfea0d2ad2e0bb0d24d30cd2d91313c
hovercard-subject-tagissue:172737066
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/2035/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e18b677c9136ca2f5a324921a6d2e610646aa511956865c6d9b3002dce499d3d/PowerShell/PowerShell/issues/2035
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e18b677c9136ca2f5a324921a6d2e610646aa511956865c6d9b3002dce499d3d/PowerShell/PowerShell/issues/2035
og:image:altSteps to reproduce Define a PowerShell function with an array parameter using the ValueFromRemainingArguments property of the Parameter attribute. Instead of sending multiple arguments, send that p...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedlwyatt
hostnamegithub.com
expected-hostnamegithub.com
None66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e
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
releaseb6f01f7cb9f35f8c09949773241a3d49dd04b340
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/PowerShell/PowerShell/issues/2035#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F2035
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%2F2035
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/2035
Reloadhttps://github.com/PowerShell/PowerShell/issues/2035
Reloadhttps://github.com/PowerShell/PowerShell/issues/2035
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 requests365 (365)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/2035
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/2035
Parameter binding problem with ValueFromRemainingArguments in PS functionshttps://github.com/PowerShell/PowerShell/issues/2035#top
Breaking-Changebreaking change that may affect usershttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Breaking-Change%22
Committee-ReviewedPS-Committee has reviewed this and made a decisionhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Committee-Reviewed%22
Issue-BugIssue has been identified as a bug in the producthttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Bug%22
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-FixedThe issue is fixed.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-Fixed%22
WG-Languageparser, language semanticshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Language%22
6.0.0-GAhttps://github.com/PowerShell/PowerShell/milestone/27
https://github.com/dlwyatt
Dave Wyatt (dlwyatt)https://github.com/dlwyatt
on Aug 23, 2016https://github.com/PowerShell/PowerShell/issues/2035#issue-172737066
Nexthttps://github.com/PowerShell/PowerShell/issues/2035?timeline_page=1
https://github.com/dlwyatt
Dave Wyatt (dlwyatt)https://github.com/dlwyatt
on Aug 23, 2016https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-241799391
https://github.com/dlwyatt
Dave Wyatt (dlwyatt)https://github.com/dlwyatt
on Aug 23, 2016https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-241801368
https://github.com/dlwyatt
Dave Wyatt (dlwyatt)https://github.com/dlwyatt
on Aug 23, 2016https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-241802142
https://github.com/dlwyatt
Dave Wyatt (dlwyatt)https://github.com/dlwyatt
on Aug 23, 2016https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-241842312
https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/engine/CmdletParameterBinderController.cs#L1696https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/engine/CmdletParameterBinderController.cs#L1696
https://github.com/MarvTheRobot
MarvTheRobot (MarvTheRobot)https://github.com/MarvTheRobot
on Aug 24, 2016https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-241961819
https://github.com/dlwyatt
Dave Wyatt (dlwyatt)https://github.com/dlwyatt
on Aug 24, 2016https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-241965543
https://github.com/MarvTheRobot
MarvTheRobot (MarvTheRobot)https://github.com/MarvTheRobot
on Aug 24, 2016https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-241967802
#2035 (comment)https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-241965543
https://github.com/jpsnover
Jeffrey Snover (jpsnover)https://github.com/jpsnover
on Aug 28, 2016https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-242979915
https://github.com/dlwyatt
Dave Wyatt (dlwyatt)https://github.com/dlwyatt
on Aug 28, 2016https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-242982462
Jeffrey Snover (@jpsnover)https://github.com/jpsnover
https://github.com/rkeithhill
Keith Hill (rkeithhill)https://github.com/rkeithhill
on Aug 28, 2016https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-242986833
https://github.com/dlwyatt
Dave Wyatt (dlwyatt)https://github.com/dlwyatt
on Aug 28, 2016https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-242987144
https://github.com/rkeithhill
Keith Hill (rkeithhill)https://github.com/rkeithhill
on Aug 28, 2016https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-242990411
https://github.com/dlwyatt
Dave Wyatt (dlwyatt)https://github.com/dlwyatt
on Aug 28, 2016https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-242990519
Joey Aiello (joeyaiello)https://github.com/joeyaiello
WG-Languageparser, language semanticshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Language%22
on Sep 6, 2016https://github.com/PowerShell/PowerShell/issues/2035#event-779825225
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
on May 15, 2017https://github.com/PowerShell/PowerShell/issues/2035#event-1082783469
Joey Aiello (joeyaiello)https://github.com/joeyaiello
on May 25, 2017https://github.com/PowerShell/PowerShell/issues/2035#event-1097665655
https://github.com/joeyaiello
Joey Aiello (joeyaiello)https://github.com/joeyaiello
on May 25, 2017https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-304068968
Dave Wyatt (@dlwyatt)https://github.com/dlwyatt
#2038https://github.com/PowerShell/PowerShell/pull/2038
Dave Wyatt (@dlwyatt)https://github.com/dlwyatt
https://github.com/dlwyatt
Dave Wyatt (dlwyatt)https://github.com/dlwyatt
on May 25, 2017https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-304085199
https://github.com/dlwyatt
Dave Wyatt (dlwyatt)https://github.com/dlwyatt
on May 25, 2017https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-304085757
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Aug 21, 2017https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-323641345
A ValueFromRemainingArguments parameter by default invariably receives a [List[object]] collection rather than a scalar / PowerShell array ([object[]]), as appropriate #4625https://github.com/PowerShell/PowerShell/issues/4625
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Aug 21, 2017https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-323816221
Dave Wyatt (dlwyatt)https://github.com/dlwyatt
on Oct 11, 2017https://github.com/PowerShell/PowerShell/issues/2035#event-1289183794
Fixes PowerShell#2035https://github.com/dlwyatt/PowerShell/commit/2af9618cbce79889ec9bc5db9a85218124a0a08a
PowerShell#2035https://github.com/PowerShell/PowerShell/issues/2035
https://docs.github.com/articles/closing-issues-via-commit-messages
2af9618https://github.com/dlwyatt/PowerShell/commit/2af9618cbce79889ec9bc5db9a85218124a0a08a
Ilya (iSazonov)https://github.com/iSazonov
Resolution-FixedThe issue is fixed.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-Fixed%22
on Oct 12, 2017https://github.com/PowerShell/PowerShell/issues/2035#event-1289431557
https://github.com/daxian-dbw
Dongbo Wang (daxian-dbw)https://github.com/daxian-dbw
on Oct 13, 2017https://github.com/PowerShell/PowerShell/issues/2035#issuecomment-336324602
#2038https://github.com/PowerShell/PowerShell/pull/2038
Dongbo Wang (daxian-dbw)https://github.com/daxian-dbw
completedhttps://github.com/PowerShell/PowerShell/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 13, 2017https://github.com/PowerShell/PowerShell/issues/2035#event-1291441229
Michael Klement (mklement0)https://github.com/mklement0
on Mar 22, 2018https://github.com/PowerShell/PowerShell/issues/2035#event-1534615454
Fix accidental wrapping of scalar Write-Output inputhttps://github.com/mklement0/PowerShell/commit/673117cf612d920ff96852af34879fa19d1ba157
673117chttps://github.com/mklement0/PowerShell/commit/673117cf612d920ff96852af34879fa19d1ba157
Sign up for freehttps://github.com/signup?return_to=https://github.com/PowerShell/PowerShell/issues/2035
Sign in to commenthttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/2035
Breaking-Changebreaking change that may affect usershttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Breaking-Change%22
Committee-ReviewedPS-Committee has reviewed this and made a decisionhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Committee-Reviewed%22
Issue-BugIssue has been identified as a bug in the producthttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Bug%22
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-FixedThe issue is fixed.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-Fixed%22
WG-Languageparser, language semanticshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Language%22
6.0.0-GAhttps://github.com/PowerShell/PowerShell/milestone/27
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.