Getting error on importing the terminal icons module
Expected Behavior
I can import the module using Import-Module Terminal-Icons without any issue.
Current Behavior
Getting the error message when trying to import.
Import-Clixml: 'Element' is an invalid XmlNodeType. Line 210, position 22.
Possible Solution
As a workaround to fix it, just delete the devblackops_*.xml files, and then importing the module will create them again.
Steps to Reproduce (for bugs)
-
Import-Module Terminal-Icons
Context
I'm getting this error message sometimes, but haven't figured out the root cause yet. I have an assumption that it is only happening when I update my PowerShell version.
The error refers to the devblackops_icon.xml file and the following piece of content:
<En>
<S N="Key">authors.md</S>
<S N="Value">nf-oct-person</S>
</En>
<En>
<S N="Key">.gitignore</S>
<S N="Value">nf-dev-git</S>
<En>
<S N="Key">.azure</S>
<S N="Value">nf-md-microsoft_azure</S>
</En>
For some reason the closing tag </En> is broken in the file. But I have no idea what changed it, because it was working before.
After using the workaround described above, I realized that the file was corrupted beyond just that missing closing tag. Unfortunately, I didn't make a copy before deleting it, so I can't attach it here. I will do that the next time the issue happens in the hopes this makes it easier to debug the issue.
Your Environment
- Module version used: 0.11.0
- Operating System and PowerShell version:
Name Value
---- -----
PSVersion 7.4.0
PSEdition Core
GitCommitId 7.4.0
OS Microsoft Windows 10.0.23590
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
- PowerShell is installed and updated through the Microsoft store
If you don't mind 1 second delay below profile works for me with a 2x2 split terminal startup with pwsh 7.4.5
oh-my-posh init pwsh --config '<your-config>.json' | Invoke-Expression
$WarningPreference = 'SilentlyContinue'
$ErrorActionPreference = 'SilentlyContinue'
Import-Module -Name Terminal-Icons
# set back to default values with a 1 second delay
Start-Sleep -Seconds 1
$WarningPreference = 'Continue'
$ErrorActionPreference = 'Continue'
If you don't mind 1 second delay below profile works for me with a 2x2 split terminal startup with pwsh 7.4.5
oh-my-posh init pwsh --config '<your-config>.json' | Invoke-Expression $WarningPreference = 'SilentlyContinue' $ErrorActionPreference = 'SilentlyContinue' Import-Module -Name Terminal-Icons # set back to default values with a 1 second delay Start-Sleep -Seconds 1 $WarningPreference = 'Continue' $ErrorActionPreference = 'Continue'
That looks like a very ugly workaround. 😅
Over time I figured out the source of the bug. It happens every time a new Powershell version is installed.
What I didn't figure out is, what happens exactly that corrupts the xml file.
My, slightly less ugly, workaround is to just delete the folder created by terminal-Icons and then let it recreate it. Since I don't use any modifications to the config, it doesn't matter to me.
Over time I figured out the source of the bug. It happens every time a new Powershell version is installed.
Unfortunately this isn't the case for me but the ugly workaround works ;)
The same problem - Powershell 7.4.6
The same problem - Powershell 7.4.6
Take a look at the solution above (mine) it works fine with 7.4.6 (or any future versions) as well.
Take a look at the solution above (mine) it works fine with 7.4.6 (or any future versions) as well.
Thanks a lot, it is helpful and I use it. But IMHO it is not a solution, it is a workaround.