Title: DynamicParam fails when there are quoted param values · Issue #3189 · PowerShell/PowerShell · GitHub
Open Graph Title: DynamicParam fails when there are quoted param values · Issue #3189 · PowerShell/PowerShell
X Title: DynamicParam fails when there are quoted param values · Issue #3189 · PowerShell/PowerShell
Description: Steps to reproduce Function New-ValidationDynamicParam { [CmdletBinding()] [OutputType('System.Management.Automation.RuntimeDefinedParameter')] param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$Name, [ValidateNotNullOrEm...
Open Graph Description: Steps to reproduce Function New-ValidationDynamicParam { [CmdletBinding()] [OutputType('System.Management.Automation.RuntimeDefinedParameter')] param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpt...
X Description: Steps to reproduce Function New-ValidationDynamicParam { [CmdletBinding()] [OutputType('System.Management.Automation.RuntimeDefinedParameter')] param ( [Parameter(Mandatory)] [ValidateNotNu...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/3189
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"DynamicParam fails when there are quoted param values","articleBody":"Steps to reproduce\r\n------------------\r\n```\r\nFunction New-ValidationDynamicParam\r\n{\r\n [CmdletBinding()]\r\n [OutputType('System.Management.Automation.RuntimeDefinedParameter')]\r\n param (\r\n [Parameter(Mandatory)]\r\n [ValidateNotNullOrEmpty()]\r\n [string]$Name,\r\n [ValidateNotNullOrEmpty()]\r\n [Parameter(Mandatory)]\r\n [array]$ValidateSetOptions,\r\n [Parameter()]\r\n [switch]$Mandatory = $false,\r\n [Parameter()]\r\n [string]$ParameterSetName = '__AllParameterSets',\r\n [Parameter()]\r\n [switch]$ValueFromPipeline = $false,\r\n [Parameter()]\r\n [switch]$ValueFromPipelineByPropertyName = $false\r\n )\r\n $AttribColl = New-Object System.Collections.ObjectModel.Collection[System.Attribute]\r\n $ParamAttrib = New-Object System.Management.Automation.ParameterAttribute\r\n $ParamAttrib.Mandatory = $Mandatory.IsPresent\r\n $ParamAttrib.ParameterSetName = $ParameterSetName\r\n $ParamAttrib.ValueFromPipeline = $ValueFromPipeline.IsPresent\r\n $ParamAttrib.ValueFromPipelineByPropertyName = $ValueFromPipelineByPropertyName.IsPresent\r\n $AttribColl.Add($ParamAttrib)\r\n $AttribColl.Add((New-Object System.Management.Automation.ValidateSetAttribute($Param.ValidateSetOptions)))\r\n $RuntimeParam = New-Object System.Management.Automation.RuntimeDefinedParameter($Param.Name, [string], $AttribColl)\r\n Return $RuntimeParam\r\n}\r\n\r\nFunction DP-Bug\r\n{\r\n [CmdletBinding()]\r\n Param\r\n (\r\n [ValidateSet(\"NoSpace\",\"Yes Space\")]\r\n [string]$Param1\r\n )\r\n\r\n DynamicParam\r\n {\r\n $ParamOptions = @(\r\n @{\r\n 'Name' = 'Param2';\r\n 'Mandatory' = $True;\r\n 'ValidateSetOptions' = @(\r\n 'Option 1',\r\n 'Option 2'\r\n )\r\n })\r\n $RuntimeParamDic = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary\r\n foreach ($Param in $ParamOptions)\r\n {\r\n $RuntimeParam = New-ValidationDynamicParam @Param\r\n $RuntimeParamDic.Add($Param.Name, $RuntimeParam)\r\n }\r\n Return $RuntimeParamDic\r\n }\r\n begin\r\n {\r\n Write-Output \"OK\"\r\n }\r\n}\r\n\r\nDP-Bug -Param1 NoSpace -\u003ctab>\r\nDP-Bug -Param1 'Yes Space' -\u003ctab>\r\n```\r\nExpected behavior\r\n-----------------\r\nDP-Bug -Param1 NoSpace -Param2\r\nDP-Bug -Param1 'Yes Space' -Param2\r\n\r\nActual behavior\r\n---------------\r\nDP-Bug -Param1 NoSpace -Param2\r\nDP-Bug -Param1 'Yes Space' -Verbose\r\n\r\nBasically, DynamicParam stops tab completing (though it does process and can become a mandatory parameter) if it is proceeded by a parameter value that has spaces/quotes around it. I tried changing the quotes from single to double as well, no change.\r\n\r\nEnvironment data\r\n----------------\r\n\r\n```\r\nName Value\r\n---- -----\r\nPSVersion 5.0.10586.117\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nBuildVersion 10.0.10586.117\r\nCLRVersion 4.0.30319.42000\r\nWSManStackVersion 3.0\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\n```\r\n","author":{"url":"https://github.com/MysticRyuujin","@type":"Person","name":"MysticRyuujin"},"datePublished":"2017-02-23T15:20:16Z","url":"https://github.com/PowerShell/PowerShell/issues/3189"}
| 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:7bee32b7-e572-3342-3ff6-18c2a3f10843 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A5C4:35C83D:9E63E6:E3461E:6AFD9EE7 |
| html-safe-nonce | 80b9faebb13dcdd478bde399b1972e9665d8b7ce504e0f87b727ffc5fff715e0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNUM0OjM1QzgzRDo5RTYzRTY6RTM0NjFFOjZBRkQ5RUU3IiwidmlzaXRvcl9pZCI6IjYyNTUwOTU2ODM4MTU1ODUwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a7fc6d943acf4a9145ec94050f983b374fca763fd5b128bad53f7deba2889ed1 |
| hovercard-subject-tag | issue:209791798 |
| 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/3189/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b21bca2bb2bf4b9c5b2255d4999c5c69dbb59ed56a261ad9cd21297701cf6908/PowerShell/PowerShell/issues/3189 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b21bca2bb2bf4b9c5b2255d4999c5c69dbb59ed56a261ad9cd21297701cf6908/PowerShell/PowerShell/issues/3189 |
| og:image:alt | Steps to reproduce Function New-ValidationDynamicParam { [CmdletBinding()] [OutputType('System.Management.Automation.RuntimeDefinedParameter')] param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpt... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MysticRyuujin |
| hostname | github.com |
| expected-hostname | github.com |
| None | bc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea |
| 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 | 927a6c5ab1c32b38830f1b9d3050c0b9e9aa92e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width