Get-PSDrive and Import-Module PSReadLine take 15 seconds to run after upgrade (7.4.5 -> 7.5.x & 7.6.x)
#26703
Replies: 1 comment
|
The What would cause a consistent per-file read timeout:
Debug in this order: # 1. Where do PSReadLine's files actually live?
Get-Module PSReadLine -ListAvailable | Select-Object Path, Version
# 2. Are any PSModulePath entries non-local (network/cloud)?
$env:PSModulePath -split ';'
# 3. Confirm and time the specific read
Measure-Command { Import-Module PSReadLine -Verbose }If a non-local path shows up in step 2, that's almost certainly it. Fixes, in order of preference:
Also worth ruling out quickly: a redirected If none of that fits, capture it with ProcMon (Sysinternals), filtered to |
Uh oh!
There was an error while loading. Please reload this page.
I upgraded to PowerShell 7.5.1 a few days ago (I had the installer lying around!), and encountered the problem that for each new PowerShell instance I open,
Get-PSDrivetakes 15 seconds to run the first time (subsequent calls run normally). I removed the call toGet-PSDrivefrom my profile, and then the call toImport-Module PSReadLinetook 15 seconds.I upgraded to 7.5.4, and everything is exactly the same.
I installed 7.6.0-preview.6, and it has an interesting behavior! When I run it as
pwsh -Command 'echo hi', it behaves exactly the same way as 7.5. But when I run it aspwsh(or I open a new window), it waits the 15 seconds BEFORE running the profile (and then the profile runs fast)!A few interesting points:
Import-Module PSReadLine -Verbose, it waits onLoading 'FormatsToProcess' ...line. (Marked in the screenshot below!)Get-PSDriveandImport-Module PSReadLineback-to-back (in any order), the second call runs quickly. But when I run the second command after some time, it again takes 15 seconds.How can I debug this behavior? (I'm a developer, and am willing to put some time into debugging it.)
All reactions