The easiest way to reproduce this is to check out this example: https://www.codeproject.com/Articles/719143/AvalonDock-Tutorial-Part-Load-Save-Layout where the saving still works and then update the AvalonDock to the latest version and see that the serialization is broken.
Comments: ** Comment from web user: BoucherS **
Hi,
Yes, there is a bug.
Upon de-serialization, a new RootPanel is created, but its orientation is always horizontal. This explains why when you dock a LayoutAnchorable on top/bottom, the de-serialization shows you horizontal panels, instead of Vertical panels.
You can fix if by going in file Xceed.Wpf.AvalonDock/Layout/LayoutRoot.cs, and doing the 2 fixes :
1) in method "ReadXml", replace :
var layoutPanelElements = this.ReadRootPanel( reader );
if( layoutPanelElements != null )
{
this.RootPanel = new LayoutPanel();
//Add all children to RootPanel
for( int i = 0; i < layoutPanelElements.Count; ++i )
{
this.RootPanel.Children.Add( layoutPanelElements[ i ] );
}
}
with
Orientation orientation;
var layoutPanelElements = this.ReadRootPanel( reader, out orientation );
if( layoutPanelElements != null )
{
this.RootPanel = new LayoutPanel() { Orientation = orientation };
//Add all children to RootPanel
for( int i = 0; i < layoutPanelElements.Count; ++i )
{
this.RootPanel.Children.Add( layoutPanelElements[ i ] );
}
}
2) Replace the "ReadRootPanel" method with the following :
private List<ILayoutPanelElement> ReadRootPanel( XmlReader reader, out Orientation orientation )
{
orientation = Orientation.Horizontal;
var result = new List<ILayoutPanelElement>();
var startElementName = reader.LocalName;
reader.Read();
if( reader.LocalName.Equals( startElementName ) && ( reader.NodeType == XmlNodeType.EndElement ) )
{
return null;
}
while( reader.NodeType == XmlNodeType.Whitespace )
{
reader.Read();
}
if( reader.LocalName.Equals( "RootPanel" ) )
{
orientation = (reader.GetAttribute( "Orientation" ) == "Vertical") ? Orientation.Vertical : Orientation.Horizontal;
reader.Read();
while( true )
{
//Read all RootPanel children
var element = ReadElement( reader ) as ILayoutPanelElement;
if( element != null )
{
result.Add( element );
}
else if( reader.NodeType == XmlNodeType.EndElement )
{
break;
}
}
}
reader.ReadEndElement();
return result;
}