Title: Intellisense: Dynamic parameters not displayed when another parameter is of a custom type. · Issue #5093 · PowerShell/PowerShell · GitHub
Open Graph Title: Intellisense: Dynamic parameters not displayed when another parameter is of a custom type. · Issue #5093 · PowerShell/PowerShell
X Title: Intellisense: Dynamic parameters not displayed when another parameter is of a custom type. · Issue #5093 · PowerShell/PowerShell
Description: Steps to reproduce I am creating a cmdlet in C# as such: namespace Test { public class CustomParameter { } [Cmdlet(VerbsCommon.Get, "ParametersTest")] public class TestCmdlet : Cmdlet, IDynamicParameters { [Parameter(Mandatory = true)] p...
Open Graph Description: Steps to reproduce I am creating a cmdlet in C# as such: namespace Test { public class CustomParameter { } [Cmdlet(VerbsCommon.Get, "ParametersTest")] public class TestCmdlet : Cmdlet, IDynamicPara...
X Description: Steps to reproduce I am creating a cmdlet in C# as such: namespace Test { public class CustomParameter { } [Cmdlet(VerbsCommon.Get, "ParametersTest")] public class TestCmdlet : Cmdlet, ID...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/5093
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Intellisense: Dynamic parameters not displayed when another parameter is of a custom type.","articleBody":"Steps to reproduce\r\n------------------\r\nI am creating a cmdlet in C# as such:\r\n```\r\nnamespace Test\r\n{\r\n public class CustomParameter\r\n {\r\n }\r\n\r\n [Cmdlet(VerbsCommon.Get, \"ParametersTest\")]\r\n public class TestCmdlet : Cmdlet, IDynamicParameters\r\n {\r\n [Parameter(Mandatory = true)]\r\n public string WebServerUrl { get; set; }\r\n\r\n [Parameter]\r\n public CustomParameter AdditionalParam { get; set; }\r\n\r\n public object GetDynamicParameters()\r\n {\r\n return new RuntimeDefinedParameterDictionary\r\n {\r\n {\"DynamicParameter\", new BooleanRuntimeDefinedParameter(\"DynamicParameter\", false)}\r\n };\r\n }\r\n }\r\n}\r\n```\r\n\r\nWhen using this cmdlet in ISE, I would expect Intellisense to show a dynamic parameter.\r\nIt does show at any point before defining the `AdditionalParam`.\r\n\r\n\r\n\r\nAfter defining `AdditionalParam`, Intellisense no longer shows the dynamic parameter.\r\nDebugging the cmdlet via Visual Studio indicates that `GetDynamicParameters` method is not called after defining this parameter.\r\n\r\n\r\n\r\n```powershell\r\n$param = [Test.CustomParameter]::new()\r\nGet-ParametersTest -WebServerUrl \"http://localhost/api\" -AdditionalParam $param\r\n```\r\n\r\nThis only happens when the additional parameter is of a custom type.\r\nIf `AdditionalParam` is of a basic type like string or object, this behaviour does not occur.\r\n\r\nExpected behavior\r\n-----------------\r\nExpecting `GetDynamicParameters` to be called and dynamic parameters displayed regardless of the type of other parameters.\r\n\r\nActual behavior\r\n---------------\r\nOutlined above.\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- provide the output of $PSVersionTable -->\r\n\r\n```powershell\r\n> $PSVersionTable\r\nName Value \r\n---- ----- \r\nPSVersion 5.1.14409.1005 \r\nPSEdition Desktop \r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} \r\nBuildVersion 10.0.14409.1005 \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/oskarm93","@type":"Person","name":"oskarm93"},"datePublished":"2017-10-12T08:26:16Z","url":"https://github.com/PowerShell/PowerShell/issues/5093"}
| 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:6bb19368-b13b-5f51-9636-dacb05affabb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D728:11FCD:8FA05:C9C00:6AFDA9AD |
| html-safe-nonce | 0ecbd30b12f495d0d005b0673057aab1ef9c41d6fbe933054a5f88454663bc1b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzI4OjExRkNEOjhGQTA1OkM5QzAwOjZBRkRBOUFEIiwidmlzaXRvcl9pZCI6IjQ4NjEzOTkxNTQ0MDg1OTU2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7aec81fdd2e1852e9ef55d50a9259a67c450c344ec65898c856969376d0b39de |
| hovercard-subject-tag | issue:264854220 |
| 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/5093/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0c0af625c230b6310ad1eac1b1e5333d9c130e7f27f6582e466640e02cb66079/PowerShell/PowerShell/issues/5093 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0c0af625c230b6310ad1eac1b1e5333d9c130e7f27f6582e466640e02cb66079/PowerShell/PowerShell/issues/5093 |
| og:image:alt | Steps to reproduce I am creating a cmdlet in C# as such: namespace Test { public class CustomParameter { } [Cmdlet(VerbsCommon.Get, "ParametersTest")] public class TestCmdlet : Cmdlet, IDynamicPara... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | oskarm93 |
| 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 | 0ddf53eb35c87f1f8df13dbf75c3bdadbfc6e969 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width