Title: Strange Get-Random Input-Object parameter behaviour · Issue #3682 · PowerShell/PowerShell · GitHub
Open Graph Title: Strange Get-Random Input-Object parameter behaviour · Issue #3682 · PowerShell/PowerShell
X Title: Strange Get-Random Input-Object parameter behaviour · Issue #3682 · PowerShell/PowerShell
Description: Steps to reproduce Get-Random -InputObject @('zzz', 'aaa', '') Get-Random @('zzz', 'aaa', '') Expected behavior InputObject parameter position value is 1, so these command should work the same way and return one of the array elements. Ac...
Open Graph Description: Steps to reproduce Get-Random -InputObject @('zzz', 'aaa', '') Get-Random @('zzz', 'aaa', '') Expected behavior InputObject parameter position value is 1, so these command should work the same way ...
X Description: Steps to reproduce Get-Random -InputObject @('zzz', 'aaa', '') Get-Random @('zzz', 'aaa', '') Expected behavior InputObject parameter position value ...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/3682
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Strange Get-Random Input-Object parameter behaviour","articleBody":"\u003c!--\r\n\r\nIf it is a bug report:\r\n- make sure you are able to repro it on the latest released version. \r\nYou can install the latest version from https://github.com/PowerShell/PowerShell/releases\r\n- Search the existing issues.\r\n- Refer to the [FAQ](../docs/FAQ.md).\r\n- Refer to the [known issues](../docs/KNOWNISSUES.md).\r\n- Fill out the following repro template\r\n\r\nIf it's not a bug, please remove the template and elaborate the issue in your own words.\r\n-->\r\n\r\nSteps to reproduce\r\n------------------\r\n```powershell\r\nGet-Random -InputObject @('zzz', 'aaa', '')\r\nGet-Random @('zzz', 'aaa', '')\r\n```\r\nExpected behavior\r\n-----------------\r\nInputObject parameter position value is 1, so these command should work the same way and return one of the array elements.\r\n\r\nActual behavior\r\n---------------\r\nWhile the second command works, first command produces error:\r\n```powershell\r\nGet-Random : Cannot validate argument on parameter 'InputObject'. The argument is null or empty. Provide an argument th\r\nat is not null or empty, and then try the command again.\r\nAt line:1 char:25\r\n+ Get-Random -InputObject @('zzz', 'aaa', '')\r\n+ ~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : InvalidData: (:) [Get-Random], ParameterBindingValidationException\r\n + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetRandomCommand\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\nSerializationVersion 1.1.0.1\r\nPSRemotingProtocolVersion 2.3\r\nBuildVersion 3.0.0.0\r\nWSManStackVersion 3.0\r\nPSVersion 6.0.0-alpha\r\nCLRVersion\r\nPSEdition Core\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nGitCommitId v6.0.0-alpha.18\r\n\r\nName Value\r\n---- -----\r\nPSVersion 5.1.15063.138\r\nPSEdition Desktop\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nBuildVersion 10.0.15063.138\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/KacperMucha","@type":"Person","name":"KacperMucha"},"datePublished":"2017-05-02T16:25:34Z","url":"https://github.com/PowerShell/PowerShell/issues/3682"}
| 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:449001e0-71b5-1997-5693-7e80ad925b58 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CACE:1EA4D5:62C3F:86BBF:6AFD4899 |
| html-safe-nonce | 03a538c9c0a2150426f937c29e6ca7dccd2ea0e103fa2cc07fa4acc875bc1838 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQUNFOjFFQTRENTo2MkMzRjo4NkJCRjo2QUZENDg5OSIsInZpc2l0b3JfaWQiOiIyODY4NzcyMDEyNTU0NTA3NzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7275a39f0fe42b652f94ba84f5e2a34d8471ed83fc63fa9428cae9120462cb67 |
| hovercard-subject-tag | issue:225748903 |
| 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/3682/issue_layout |
| twitter:image | https://opengraph.githubassets.com/04567034643a6ceb8aef7fb07fcd82008ee3745cde25490a035451fa91e20205/PowerShell/PowerShell/issues/3682 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/04567034643a6ceb8aef7fb07fcd82008ee3745cde25490a035451fa91e20205/PowerShell/PowerShell/issues/3682 |
| og:image:alt | Steps to reproduce Get-Random -InputObject @('zzz', 'aaa', '') Get-Random @('zzz', 'aaa', '') Expected behavior InputObject parameter position value is 1, so these command should work the same way ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | KacperMucha |
| hostname | github.com |
| expected-hostname | github.com |
| None | bdbacc25b921224ff0befcb9e629560a1255be51aec9991d6e3f95b5e9151474 |
| 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 | 556dd37bb0aceffb25724e151b5d858b3265b40b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width