-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
When I am trying to import my Format.ps1xml file, I get a very unspecific errors message. I am coming here because I couldn't figure out what is wrong about this file after reading the XML reference extensively, asking a question on StackOverflow and Gitter, and even digging through the PowerShell source code to find out where it is thrown.
I assume this is not a bug, so it would be great if the error had a more helpful error message. An XSD schema would also help.
Steps to reproduce
<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
<ViewDefinitions>
<View>
<Name>MyType</Name>
<ViewSelectedBy>
<TypeName>MyTypeName1</TypeName>
<TypeName>MyTypeName2</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<EntrySelectedBy>
<TypeName>MyTypeName1</TypeName>
</EntrySelectedBy>
<ListItems>
<ListItem>
<PropertyName>myProp1</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
<ListEntry>
<EntrySelectedBy>
<TypeName>MyTypeName2</TypeName>
</EntrySelectedBy>
<ListItems>
<ListItem>
<PropertyName>myProp2</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
</ViewDefinitions>
</Configuration>Update-FormatData test.Format.ps1xmlExpected behavior
This should load without error, and make MyTypeName1 and MyTypeName2 display as a list, with myProp1 being shown for MyTypeName1 and myProp2 being shown for MyTypeName2.
Actual behavior
This error:
Update-FormatData : Errors occurred while loading the format data file:
test.Format.ps1xml, Error at XPath /Configuration/ViewDefinitions/View[1] in file test.Format.ps1xml: A node is missing from TableControl, ListControl, WideControl, CustomControl.
At line:1 char:1
+ Update-FormatData ./PSSourcegraph.Format.ps1xml
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Update-FormatData], RuntimeException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.UpdateFormatDataCommand
I don't see what node is missing.
Weirdly, if I remove EntrySelectedBy, the error doesn't occur - but I need it to switch between the types, and I don't see what else I am missing from the documentation.
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.1
PSEdition Core
GitCommitId v6.0.1
OS Darwin 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar 5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0