Title: Get-Module is polluting $error (from formatting script) (when strict mode on) · Issue #11909 · PowerShell/PowerShell · GitHub
Open Graph Title: Get-Module is polluting $error (from formatting script) (when strict mode on) · Issue #11909 · PowerShell/PowerShell
X Title: Get-Module is polluting $error (from formatting script) (when strict mode on) · Issue #11909 · PowerShell/PowerShell
Description: Seems this error comes from PowerShellCore_format_ps1xml.cs, from a handful of script blocks that look like this: .AddScriptBlockColumn(@" if ($_.PrivateData -and $_.PrivateData.PSData) { $_.PrivateData.PSData.PreRelease }") And of cours...
Open Graph Description: Seems this error comes from PowerShellCore_format_ps1xml.cs, from a handful of script blocks that look like this: .AddScriptBlockColumn(@" if ($_.PrivateData -and $_.PrivateData.PSData) { $_.Privat...
X Description: Seems this error comes from PowerShellCore_format_ps1xml.cs, from a handful of script blocks that look like this: .AddScriptBlockColumn(@" if ($_.PrivateData -and $_.PrivateData.PSData) { $_.P...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/11909
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Get-Module is polluting $error (from formatting script) (when strict mode on)","articleBody":"Seems this error comes from PowerShellCore_format_ps1xml.cs, from a handful of script blocks that look like this:\r\n\r\n```csharp\r\n.AddScriptBlockColumn(@\"\r\n if ($_.PrivateData -and $_.PrivateData.PSData)\r\n {\r\n $_.PrivateData.PSData.PreRelease\r\n }\")\r\n```\r\n\r\nAnd of course `PreRelease` will not be defined for many (most?) modules that are out there.\r\n\r\n# Steps to reproduce\r\n\r\n```powershell\r\n$error.Clear()\r\nSet-StrictMode -Version Latest\r\nNew-ModuleManifest .\\foo.psd1\r\nipmo .\\foo.psd1\r\nGet-Module foo | Out-Null\r\n$error\r\n```\r\n\r\n# Expected behavior\r\n\r\nThere should be no errors in `$error`, so there should be no output from the repro steps.\r\n\r\n```none\r\n\u003cno output>\r\n```\r\n\r\n# Actual behavior\r\nError!\r\n\r\n```none\r\nPropertyNotFoundException:\r\nLine |\r\n 4 | $_.PrivateData.PSData.PreRelease\r\n | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n | The property 'PreRelease' cannot be found on this object. Verify that the property exists.\r\n```\r\n\r\nAlthough it doesn't show up in normal output, if you look into`$error`, it's there, making you wonder what went wrong. If you are looking into `$error`, you are probably trying to troubleshoot some problem, and you only want to see \"real\" errors in `$error`, and not be distracted or confused by things that just look like bugs in PowerShell.\r\n\r\nLooking at it another way: I didn't run some command with `-ErrorAction SilentlyContinue`, and I didn't see an error from the command... so why in the world is an error showing up in `$error`? (That's why I described it as \"polluting `$error`\"--it seemingly is not an error; just the result of some internal PS bug scribbling useless and distracting information into it.)\r\n\r\n# Environment data\r\n\r\n\u003c!-- provide the output of $PSVersionTable -->\r\n\r\n```none\r\nName Value\r\n---- -----\r\nPSVersion 7.0.0-preview.7\r\nPSEdition Core\r\nGitCommitId 7.0.0-preview.7\r\nOS Microsoft Windows 10.0.19570\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","author":{"url":"https://github.com/jazzdelightsme","@type":"Person","name":"jazzdelightsme"},"datePublished":"2020-02-21T02:56:19Z","url":"https://github.com/PowerShell/PowerShell/issues/11909"}
| 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:a826d493-6a99-a187-7cbc-8f53680ce3fd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE86:1CECE4:72FB:9DC3:6AFD6593 |
| html-safe-nonce | af9002509d52a86296f262f42d75879a52cdcf8ee5c726add7de6081a8138446 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTg2OjFDRUNFNDo3MkZCOjlEQzM6NkFGRDY1OTMiLCJ2aXNpdG9yX2lkIjoiNDQ0MzE3NjMwMjY2ODUwNjUxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 33eb3676f72d5d2b8cc2d8e5aefd00a7be7c664753d18769646515c83f5bb3d7 |
| hovercard-subject-tag | issue:568704508 |
| 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/11909/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b76648438efec96659ff8d33c3d0c0149c1c2626178501c1554bdb5fe3618a71/PowerShell/PowerShell/issues/11909 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b76648438efec96659ff8d33c3d0c0149c1c2626178501c1554bdb5fe3618a71/PowerShell/PowerShell/issues/11909 |
| og:image:alt | Seems this error comes from PowerShellCore_format_ps1xml.cs, from a handful of script blocks that look like this: .AddScriptBlockColumn(@" if ($_.PrivateData -and $_.PrivateData.PSData) { $_.Privat... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jazzdelightsme |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42a67d7c7488271ca8d7e6dc3942424e6de3bff43b1ed4a9c6f0e1a69b73b389 |
| 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 | 5c3779ac05f3590d8d7ea0c02b14e678ae8179ae |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width