Powershell: Errors occurred while loading the format data file

Created on 27 Jan 2017  路  2Comments  路  Source: PowerShell/PowerShell

Steps to reproduce

Attempt to Import PowerShellHumanizer module v3.1.

Expected behavior

PowerShell loads the custom type data files.

Actual behavior

Errors about CustomEntries and CustonItem Xml nodes. An error about resource FileSystemProviderStrings missing from System.Management.Automation

ipmo : Errors occurred while loading the format data file:
C:\powershell6\Modules\PowerShellHumanizer\3.1\FileInfo.format.ps1xml, Error at XPath
/Configuration/Controls/Control[1]/CustomControl/CustomEntries in file
C:\powershell6\Modules\PowerShellHumanizer\3.1\FileInfo.format.ps1xml: CustomEntry failed to load.
C:\powershell6\Modules\PowerShellHumanizer\3.1\FileInfo.format.ps1xml, Error at XPath
/Configuration/Controls/Control[1]/CustomControl/CustomEntries/CustomEntry[1] in file
C:\powershell6\Modules\PowerShellHumanizer\3.1\FileInfo.format.ps1xml: Node CustomItem is missing.
C:\powershell6\Modules\PowerShellHumanizer\3.1\FileInfo.format.ps1xml, Error at XPath
/Configuration/Controls/Control[1]/CustomControl/CustomEntries/CustomEntry[1]/CustomItem in file
C:\powershell6\Modules\PowerShellHumanizer\3.1\FileInfo.format.ps1xml: Frame failed to load.
C:\powershell6\Modules\PowerShellHumanizer\3.1\FileInfo.format.ps1xml, Error at XPath
/Configuration/Controls/Control[1]/CustomControl/CustomEntries/CustomEntry[1]/CustomItem/Frame[1] in file
C:\powershell6\Modules\PowerShellHumanizer\3.1\FileInfo.format.ps1xml: Node CustomItem is missing.
C:\powershell6\Modules\PowerShellHumanizer\3.1\FileInfo.format.ps1xml, Error at XPath
/Configuration/Controls/Control[1]/CustomControl/CustomEntries/CustomEntry[1]/CustomItem/Frame[1]/CustomItem in file
C:\powershell6\Modules\PowerShellHumanizer\3.1\FileInfo.format.ps1xml: Text failed to load.
C:\powershell6\Modules\PowerShellHumanizer\3.1\FileInfo.format.ps1xml, Error at XPath
/Configuration/Controls/Control[1]/CustomControl/CustomEntries/CustomEntry[1]/CustomItem/Frame[1]/CustomItem/Text[1]
in file C:\powershell6\Modules\PowerShellHumanizer\3.1\FileInfo.format.ps1xml: The resource FileSystemProviderStrings
in assembly C:\System.Management.Automation is not found.

Environment data

Name                           Value                                                                                   
----                           -----                                                                                   
BuildVersion                   3.0.0.0                                                                                 
GitCommitId                    v6.0.0-alpha.15                                                                         
SerializationVersion           1.1.0.1                                                                                 
CLRVersion                                                                                                             
WSManStackVersion              3.0                                                                                     
PSVersion                      6.0.0-alpha                                                                             
PSRemotingProtocolVersion      2.3                                                                                     
PSEdition                      Core                                                                                    
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
Resolution-Fixed WG-Engine

Most helpful comment

Looks like this is a resource addressing problem; Not really related to format.ps1xml.
From WindowsPS to PSCore resource paths have changed like this example:
WindowsPS: FileSystemProviderStrings
PSCore: System.Management.Automation.resources.FileSystemProviderStrings

... and PowerShellHumanizer(v3.1) module uses 'WindowsPS' syntax:
<Text AssemblyName="System.Management.Automation" BaseName="FileSystemProviderStrings" ResourceId="DirectoryDisplayGrouping"/>
, so this resource is not found when module is loaded on PSCore.

Since this blocks some existing modules from running on PSCore, I'll add code to check for alternative resource path.

All 2 comments

@steve had me assign this a 6.0.0-beta milestone to make sure we haven't broken format.ps1xml in 6.0

Looks like this is a resource addressing problem; Not really related to format.ps1xml.
From WindowsPS to PSCore resource paths have changed like this example:
WindowsPS: FileSystemProviderStrings
PSCore: System.Management.Automation.resources.FileSystemProviderStrings

... and PowerShellHumanizer(v3.1) module uses 'WindowsPS' syntax:
<Text AssemblyName="System.Management.Automation" BaseName="FileSystemProviderStrings" ResourceId="DirectoryDisplayGrouping"/>
, so this resource is not found when module is loaded on PSCore.

Since this blocks some existing modules from running on PSCore, I'll add code to check for alternative resource path.

Was this page helpful?
0 / 5 - 0 ratings