Title: Class with hidden property breaking for-display formatting? · Issue #17071 · PowerShell/PowerShell · GitHub
Open Graph Title: Class with hidden property breaking for-display formatting? · Issue #17071 · PowerShell/PowerShell
X Title: Class with hidden property breaking for-display formatting? · Issue #17071 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/17071
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Class with hidden property breaking for-display formatting?","articleBody":"### Prerequisites\r\n\r\n- [X] Write a descriptive title.\r\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\r\n- [X] Search the existing issues.\r\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\r\n\r\n### Steps to reproduce\r\n\r\nObject instances with _hidden or private_ properties could be breaking the [for-display formatting](https://stackoverflow.com/questions/71631192/implicit-conversion-to-bool-of-struct-defined-in-c-sharp-fails-in-powershell/71632418?noredirect=1#comment126599208_71632418) when piped to `Get-Member` as well as `Select-Object *`.\r\n\r\n```powershell\r\nclass MyBool2 {\r\n hidden [bool] $Value\r\n \r\n MyBool2([bool] $Value) {\r\n $this.Value = $Value\r\n }\r\n\r\n [string] ToString() {\r\n return \"$($this.Value)\"\r\n }\r\n}\r\n```\r\n\r\n### Expected behavior\r\n\r\n```powershell\r\nPS /> $instance = [MyBool2] $true\r\nPS /> $instance\r\nTrue\r\n\r\nPS /> $instance | Get-Member\r\n\r\n TypeName: MyBool2\r\n\r\nName MemberType Definition\r\n---- ---------- ----------\r\nEquals Method bool Equals(System.Object obj)\r\nGetHashCode Method int GetHashCode()\r\nGetType Method type GetType()\r\nToString Method string ToString()\r\n\r\nPS /> $instance\r\nTrue\r\n\r\nPS /> $instance.ToString()\r\nTrue\r\n```\r\n\r\n\r\n### Actual behavior\r\n\r\n```powershell\r\nPS /> $instance = [MyBool2] $true\r\nPS /> $instance\r\nTrue\r\n\r\nPS /> $instance | Get-Member\r\n\r\n TypeName: MyBool2\r\n\r\nName MemberType Definition\r\n---- ---------- ----------\r\nEquals Method bool Equals(System.Object obj)\r\nGetHashCode Method int GetHashCode()\r\nGetType Method type GetType()\r\nToString Method string ToString()\r\n\r\nPS /> $instance\r\n\r\n\r\nPS /> $instance.ToString()\r\nTrue\r\n```\r\n\r\n\r\n### Error details\r\n_No errors._\r\n\r\n\r\n### Environment data\r\n\r\n```powershell\r\nName Value\r\n---- -----\r\nPSVersion 7.2.2\r\nPSEdition Core\r\nGitCommitId 7.2.2\r\nOS Microsoft Windows 10.0.19043\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} \r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n\r\n\r\n### Visuals\r\n\r\n_No response_","author":{"url":"https://github.com/santisq","@type":"Person","name":"santisq"},"datePublished":"2022-03-27T17:28:43Z","url":"https://github.com/PowerShell/PowerShell/issues/17071"}
| 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:41052e22-8129-4817-d360-ed9a6a9a7f37 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CAB2:338C0B:B4704:10883B:6AFD70B3 |
| html-safe-nonce | f5e11baf4f742cde6fe5d138a8ddbeff76f4208ee516c949540618e55569f7fd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQUIyOjMzOEMwQjpCNDcwNDoxMDg4M0I6NkFGRDcwQjMiLCJ2aXNpdG9yX2lkIjoiNTQ0NzQwNDg3NTU1MTY5OTEyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 16e2ee7eda73cdb042896e8375692947866443080a1bed2094ba5d12dd8434b7 |
| hovercard-subject-tag | issue:1182603666 |
| 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/17071/issue_layout |
| twitter:image | https://opengraph.githubassets.com/99b3e52e8b7c787a4e048b071a2b042efe0aac33c821a77c1a67a50539da3126/PowerShell/PowerShell/issues/17071 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/99b3e52e8b7c787a4e048b071a2b042efe0aac33c821a77c1a67a50539da3126/PowerShell/PowerShell/issues/17071 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | santisq |
| hostname | github.com |
| expected-hostname | github.com |
| None | e54006cf2b96d1ac260960edd10003132911469ccd1ec99c9803119fe2a4e032 |
| 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 | 5be0bf2b8cf26f8897d31e6bc3c232d328b12a54 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width