-
Notifications
You must be signed in to change notification settings - Fork 336
Closed
Labels
Description
When trying to deserialize a layout, the following exception is thrown:
System.InvalidOperationException: There is an error in XML document (17, 14).
---> System.ArgumentException: AvalonDock.LayoutRoot doesn't know how to deserialize
at Xceed.Wpf.AvalonDock.Layout.LayoutRoot.ReadElement(XmlReader reader)
at Xceed.Wpf.AvalonDock.Layout.LayoutRoot.ReadElementList(XmlReader reader, Boolean isFloatingWindow)
at Xceed.Wpf.AvalonDock.Layout.LayoutRoot.ReadXml(XmlReader reader)
at System.Xml.Serialization.XmlSerializationReader.ReadSerializable(IXmlSerializable serializable, Boolean wrappedAny)
at System.Xml.Serialization.XmlSerializationReader.ReadSerializable(IXmlSerializable serializable)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderLayoutRoot.Read1_LayoutRoot()
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(TextReader textReader)
at Xceed.Wpf.AvalonDock.Layout.Serialization.XmlLayoutSerializer.Deserialize(TextReader reader)
Layout XML:
<LayoutRoot>
<RootPanel Orientation="Horizontal">
<LayoutAnchorablePane Id="3305ae34-d029-44f2-a5f1-de32a4e7c7bf" Name="Documents" DockWidth="200" />
<LayoutDocumentPane>
<LayoutDocument IsSelected="True" IsLastFocusedDocument="True" LastActivationTimeStamp="01/27/2020 07:52:18" />
<LayoutDocument />
</LayoutDocumentPane>
</RootPanel>
<TopSide />
<RightSide />
<LeftSide>
<LayoutAnchorGroup PreviousContainerId="3305ae34-d029-44f2-a5f1-de32a4e7c7bf">
<LayoutAnchorable CanHide="False" AutoHideWidth="200" AutoHideMinWidth="100" AutoHideMinHeight="100" Title="Documents" ContentId="DocumentTree" CanClose="False" CanFloat="False" />
</LayoutAnchorGroup>
</LeftSide>
<BottomSide />
</LayoutRoot>
Looking at the stack on first-chance exception, the xmlReader
is at EOF (NodeType=None
) so the following method should check that condition:
private object ReadElement(XmlReader reader) |
Note the same code worked just fine in the WPF Toolkit version.