-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Import-Clixml Error when opening Terminal #126
Comments
We would want to see the output from the below after the error. get-error -last 2 Additionally, does the same error happen when you load PowerShell Core with no profile? You launch with Lastly, it is possibly related to #121. |
If you don't mind 1 second delay below profile works for me with a 2x2 split terminal startup with pwsh 7.4.5
|
Similar error for me: import-module terminal-icons
Import-Clixml: Value for dictionary entry is not specified. Line 603, position 40. Full error: PSMessageDetails :
Exception : System.Xml.XmlException: Value for dictionary entry is not specified. Line 603, position 40.
at System.Management.Automation.InternalDeserializer.ReadDictionary(ContainerType ct, ConsolidatedString
InternalTypeNames)
at System.Management.Automation.InternalDeserializer.ReadPSObject()
at System.Management.Automation.InternalDeserializer.ReadOneDeserializedObject(String& streamName, Boolean&
isKnownPrimitiveType)
at System.Management.Automation.InternalDeserializer.ReadOneObject(String& streamName)
at System.Management.Automation.InternalDeserializer.ReadDictionary(ContainerType ct, ConsolidatedString
InternalTypeNames)
at System.Management.Automation.InternalDeserializer.ReadPSObject()
at System.Management.Automation.InternalDeserializer.ReadOneDeserializedObject(String& streamName, Boolean&
isKnownPrimitiveType)
at System.Management.Automation.InternalDeserializer.ReadOneObject(String& streamName)
at System.Management.Automation.InternalDeserializer.ReadDictionary(ContainerType ct, ConsolidatedString
InternalTypeNames)
at System.Management.Automation.InternalDeserializer.ReadPSObject()
at System.Management.Automation.InternalDeserializer.ReadOneDeserializedObject(String& streamName, Boolean&
isKnownPrimitiveType)
at System.Management.Automation.InternalDeserializer.ReadOneObject(String& streamName)
at System.Management.Automation.Deserializer.Deserialize(String& streamName)
at System.Management.Automation.Deserializer.Deserialize()
at Microsoft.PowerShell.Commands.ImportXmlHelper.Import()
at Microsoft.PowerShell.Commands.ImportClixmlCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
TargetObject :
CategoryInfo : NotSpecified: (:) [Import-Clixml], XmlException
FullyQualifiedErrorId : System.Xml.XmlException,Microsoft.PowerShell.Commands.ImportClixmlCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, C:\Users\jakew\OneDrive\Documents\PowerShell\Modules\terminal-icons\0.11.0\Terminal-Icons.psm1: line
3419
at <ScriptBlock>, C:\Users\jakew\OneDrive\Documents\PowerShell\Modules\terminal-icons\0.11.0\Terminal-Icons.psm1: line
3418
at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {} When exploring these lines in (Get-ChildItem $userThemePath -Filter '*_icon.xml').ForEach({
$userIconTheme = Import-CliXml -Path $_.FullName
$userThemeData.Themes.Icon[$userIconTheme.Name] = $userIconTheme
}) I found that This location did not contain the expected xml files, thus why this error was occuring. My workaround to address this for me was:
The above steps caused the module to create a: |
The simplest temporary workaround I've found for these # REF: https://stapp.space/few-steps-to-pimp-my-terminal/#my-profile-file
function Import-Module-With-Measure {
param ($ModuleName)
$import = Measure-Command {
Import-Module $ModuleName
}
Write-Host "Loading $ModuleName took $([math]::Round($import.TotalMilliseconds))ms."
}
$terminalIconsFolder = "$env:APPDATA\powershell\Community\Terminal-Icons"
if (Test-Path $terminalIconsFolder){
Remove-Item $terminalIconsFolder -Recurse
}
Import-Module-With-Measure Terminal-Icons The module automatically recreates this folder when it loads. With my 8th Gen Intel® Core™ i7-8700 CPU @ 3.20GHz processor, the module only takes |
This is the full stacktrace obtained using Details - Terminal Output
λ $Error | Get-Error
Exception :
Type : System.Management.Automation.RuntimeException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Index operation failed; the array index evaluated to null.
HResult : -2146233087
CategoryInfo : InvalidOperation: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : NullArrayIndex
InvocationInfo :
ScriptLineNumber : 3416
OffsetInLine : 5
HistoryId : 1
ScriptName : C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Terminal-Icons.
psm1
Line : $userThemeData.Themes.Icon[$userIconTheme.Name] = $userIconTheme
Statement : $userThemeData.Themes.Icon[$userIconTheme.Name] = $userIconTheme
PositionMessage : At C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Terminal-Ico
ns.psm1:3416 char:5
+ $userThemeData.Themes.Icon[$userIconTheme.Name] = $userIconTheme
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0
PSCommandPath : C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Terminal-Icons.
psm1
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.1
1.0\Terminal-Icons.psm1: line 3416
at <ScriptBlock>, C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.1
1.0\Terminal-Icons.psm1: line 3414
at <ScriptBlock>, C:\Users\<example>\Documents\PowerShell\Microsoft.PowerShell_profi
le.ps1: line 25
at <ScriptBlock>, <No file>: line 1
TargetSite : System.Object CallSite.Target(System.Runtime.CompilerServices.Closure, System.Runtime.CompilerServices.
CallSite, System.Object, System.Object, System.Object)
Message : Index operation failed; the array index evaluated to null.
Data : System.Collections.ListDictionaryInternal
Source : Anonymously Hosted DynamicMethods Assembly
HResult : -2146233087
StackTrace :
at CallSite.Target(Closure, CallSite, Object, Object, Object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at System.Management.Automation.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
CategoryInfo : InvalidOperation: (:) [], RuntimeException
FullyQualifiedErrorId : NullArrayIndex
InvocationInfo :
ScriptLineNumber : 3416
OffsetInLine : 5
HistoryId : 1
ScriptName : C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Terminal-Icons.psm1
Line : $userThemeData.Themes.Icon[$userIconTheme.Name] = $userIconTheme
Statement : $userThemeData.Themes.Icon[$userIconTheme.Name] = $userIconTheme
PositionMessage : At C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Terminal-Icons.psm1:
3416 char:5
+ $userThemeData.Themes.Icon[$userIconTheme.Name] = $userIconTheme
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0
PSCommandPath : C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Terminal-Icons.psm1
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Term
inal-Icons.psm1: line 3416
at <ScriptBlock>, C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Term
inal-Icons.psm1: line 3414
at <ScriptBlock>, C:\Users\<example>\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:
line 25
at <ScriptBlock>, <No file>: line 1
Exception :
Type : System.Xml.XmlException
LineNumber : 1156
LinePosition : 50
Message : The 'S' start tag on line 1156 position 22 does not match the end tag of 'En'. Line 1156, position 50.
TargetSite :
Name : Throw
DeclaringType : [System.Xml.XmlTextReaderImpl]
MemberType : Method
Module : System.Private.Xml.dll
Source : System.Private.Xml
HResult : -2146232000
StackTrace :
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlReader.InternalReadContentAsString()
at System.Xml.XmlReader.ReadElementContentAsString()
at System.Management.Automation.InternalDeserializer.ReadDecodedElementString(String element)
at System.Management.Automation.InternalDeserializer.ReadPrimaryKnownType(TypeSerializationInfo pktInfo)
at System.Management.Automation.InternalDeserializer.ReadOneDeserializedObject(String& streamName, Boolean& isKnownPri
mitiveType)
at System.Management.Automation.InternalDeserializer.ReadOneObject(String& streamName)
at System.Management.Automation.InternalDeserializer.ReadDictionary(ContainerType ct, ConsolidatedString InternalTypeN
ames)
at System.Management.Automation.InternalDeserializer.ReadPSObject()
at System.Management.Automation.InternalDeserializer.ReadOneDeserializedObject(String& streamName, Boolean& isKnownPri
mitiveType)
at System.Management.Automation.InternalDeserializer.ReadOneObject(String& streamName)
at System.Management.Automation.InternalDeserializer.ReadDictionary(ContainerType ct, ConsolidatedString InternalTypeN
ames)
at System.Management.Automation.InternalDeserializer.ReadPSObject()
at System.Management.Automation.InternalDeserializer.ReadOneDeserializedObject(String& streamName, Boolean& isKnownPri
mitiveType)
at System.Management.Automation.InternalDeserializer.ReadOneObject(String& streamName)
at System.Management.Automation.InternalDeserializer.ReadDictionary(ContainerType ct, ConsolidatedString InternalTypeN
ames)
at System.Management.Automation.InternalDeserializer.ReadPSObject()
at System.Management.Automation.InternalDeserializer.ReadOneDeserializedObject(String& streamName, Boolean& isKnownPri
mitiveType)
at System.Management.Automation.InternalDeserializer.ReadOneObject(String& streamName)
at System.Management.Automation.Deserializer.Deserialize(String& streamName)
at System.Management.Automation.Deserializer.Deserialize()
at Microsoft.PowerShell.Commands.ImportXmlHelper.Import()
at Microsoft.PowerShell.Commands.ImportClixmlCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
CategoryInfo : NotSpecified: (:) [Import-Clixml], XmlException
FullyQualifiedErrorId : System.Xml.XmlException,Microsoft.PowerShell.Commands.ImportClixmlCommand
InvocationInfo :
MyCommand : Import-Clixml
ScriptLineNumber : 3415
OffsetInLine : 22
HistoryId : 1
ScriptName : C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Terminal-Icons.psm1
Line : $userIconTheme = Import-CliXml -Path $_.FullName
Statement : Import-CliXml -Path $_.FullName
PositionMessage : At C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Terminal-Icons.psm1:
3415 char:22
+ $userIconTheme = Import-CliXml -Path $_.FullName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0
PSCommandPath : C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Terminal-Icons.psm1
InvocationName : Import-CliXml
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Term
inal-Icons.psm1: line 3415
at <ScriptBlock>, C:\Users\<example>\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Term
inal-Icons.psm1: line 3414
at <ScriptBlock>, C:\Users\<example>\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:
line 25
at <ScriptBlock>, <No file>: line 1 |
Current Behavior
I get an error randomly when i open the terminal, it only gives an error at launch.
Error Message:
(yesterday, when i checked i received this error message)
(this error i just received)
Steps to Reproduce (for bugs)
Opening the terminal randomly gives the error, sometimes i see the error, othertimes i don't.
The error doesn't seem to be causing any issues with the terminal, most probably just a visual error.
Your Environment
OS Version: Windows 10(22H2)
Terminal: Powershell 7.4.1
I'm using ohmyposh and Terminal-Icons powershell modules
The text was updated successfully, but these errors were encountered: