-
Notifications
You must be signed in to change notification settings - Fork 8.2k
$ErrorView = "ConciseView" does not print any errors with module autoloading disabled #12671
Description
PowerShell Core version: v7.0.1
Steps to reproduce
Run the following lines in pwsh -noprofile:
$PSModuleAutoLoadingPreference = "None"
$ErrorView = "ConciseView"
NonExistentCmdlet
$ErrorView = "NormalView"
NonExistentCmdlet
$ErrorView = "ConciseView"
NonExistentCmdletExpected behavior
3 error messages are thrown, 1st and 3rd one formatted as concise error messages, 2nd one as normal error message.
Actual behavior
When $ErrorView is set to "ConciseView", the errors are silently ignored and nothing is displayed. "NormalView" works correctly.

When running with Set-PSDebug -Trace 2, the following output is displayed:

The output indicates that while printing output, the ConciseView error printing code uses Test-Path, which is not loaded because of the disabled auto-loading.
Then, I attempted to first run Import-Module Microsoft.PowerShell.Management, which contains the Test-Path cmdlet. After the import, with auto-loading still disabled, errors now correctly print in ConciseView.
This leads me to believe that the issue is in Get-ConciseViewPositionMessage function attempting to use Test-Path, which is unavailable due to disabled auto-loading.
Environment data
PowerShell Core:
Name Value
---- -----
PSVersion 7.0.1
PSEdition Core
GitCommitId 7.0.1
OS Microsoft Windows 10.0.18362
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0