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 course PreRelease will not be defined for many (most?) modules that are out there.
Steps to reproduce
$error.Clear()
Set-StrictMode -Version Latest
New-ModuleManifest .\foo.psd1
ipmo .\foo.psd1
Get-Module foo | Out-Null
$error
Expected behavior
There should be no errors in $error, so there should be no output from the repro steps.
Actual behavior
Error!
PropertyNotFoundException:
Line |
4 | $_.PrivateData.PSData.PreRelease
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The property 'PreRelease' cannot be found on this object. Verify that the property exists.
Although 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.
Looking 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.)
Environment data
Name Value
---- -----
PSVersion 7.0.0-preview.7
PSEdition Core
GitCommitId 7.0.0-preview.7
OS Microsoft Windows 10.0.19570
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Seems this error comes from PowerShellCore_format_ps1xml.cs, from a handful of script blocks that look like this:
And of course
PreReleasewill not be defined for many (most?) modules that are out there.Steps to reproduce
Expected behavior
There should be no errors in
$error, so there should be no output from the repro steps.Actual behavior
Error!
Although 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.Looking 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.)Environment data