Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error on importing the terminal icons module #121

Open
totkeks opened this issue Nov 25, 2023 · 3 comments
Open

Getting error on importing the terminal icons module #121

totkeks opened this issue Nov 25, 2023 · 3 comments

Comments

@totkeks
Copy link

totkeks commented Nov 25, 2023

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)

  1. 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
@hero3616
Copy link

hero3616 commented Sep 6, 2024

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'

@totkeks
Copy link
Author

totkeks commented Sep 6, 2024

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.

@hero3616
Copy link

hero3616 commented Sep 6, 2024

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 ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants