PowerShell 5.1 on Win10 1709.
Does anyone use PSColor?
I have a weird problem. I added
Import-Module PSColor
in my profile.ps1. In straight Powershell, it works fine. ISE, however, started freezing upon startup. By “freeze” I mean I never get the right-hand window showing the command list, and ISE will take NO input — can’t use the menu, can’t close the window, etc. The only thing I can do is kill it with Task Manager (ProcessExplorer, technically). It wasn’t using any CPU when I did, so it doesn’t appear to be locked in a loop of some sort or anything.
I have confirmed it’s PSColor doing this by eventually narrowing it down to just a one-line profile.ps1 that contains only the above Import-Module line. With that one-line profile, opening PowerShell works fine, opening ISE freezes.
But, if I rename that one line profile.ps1 to pscolor.ps1, start ISE, and then source the file with
. ./pscolor.ps1
it works fine. And the colors work fine, i.e. a subsequent “dir” shows the appropriate colors on the files/directories. Those two things would seem to indicate that PSColor isn’t incompatible with ISE.
So why would the Import-Module freeze it, but only when it’s in the profile?
Any ideas on how I can debug this further (I’m a relative newcomer to PowerShell), or has anyone else ever encountered this?
Thanks!