Skip to content

(Fixed) AvalonDock Bug after reloading layout

Dirkster99 edited this page Jul 18, 2018 · 4 revisions

AvalonDock 3.3

The property LeftSide, RightSide, TopSide, BottomSide in the Layout property of the DocumentManager is null if the loaded data did not contain an element on that side. The following workflow can be used to verify the original problem in build:

https://github.com/Dirkster99/AvalonDock/tree/b7cde7d2a2ef2a56f23f74cad762305113686642

Start the Application

Save the Layout

Re-Load the Layout

Drag the Toolwindow from the Right Side to the Left Side

Click the Auto-Hide Button

The System shows an exception:

Exception Details

Exception Message: "Object reference not set to an instance of an object."

at Xceed.Wpf.AvalonDock.Layout.LayoutAnchorable.ToggleAutoHide() in C:\...\AvalonDock-b7cde7d2a2ef2a56f23f74cad762305113686642\source\Components\Xceed.Wpf.AvalonDock\Layout\LayoutAnchorable.cs:line 541 at Xceed.Wpf.AvalonDock.DockingManager._ExecuteAutoHideCommand(LayoutAnchorable _anchorable) in C:\...\AvalonDock-b7cde7d2a2ef2a56f23f74cad762305113686642\source\Components\Xceed.Wpf.AvalonDock\DockingManager.cs:line 2556 at Xceed.Wpf.AvalonDock.Controls.LayoutAnchorableItem.ExecuteAutoHideCommand(Object parameter) in C:\...\AvalonDock-b7cde7d2a2ef2a56f23f74cad762305113686642\source\Components\Xceed.Wpf.AvalonDock\Controls\LayoutAnchorableItem.cs:line 219 at Xceed.Wpf.AvalonDock.Controls.LayoutAnchorableItem.<InitDefaultCommands>b__8_2(Object p) in C:\...\AvalonDock-b7cde7d2a2ef2a56f23f74cad762305113686642\source\Components\Xceed.Wpf.AvalonDock\Controls\LayoutAnchorableItem.cs:line 68 at Xceed.Wpf.AvalonDock.Commands.RelayCommand.Execute(Object parameter) in C:\...\AvalonDock-b7cde7d2a2ef2a56f23f74cad762305113686642\source\Components\Xceed.Wpf.AvalonDock\Commands\RelayCommand.cs:line 66 at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated) at System.Windows.Controls.Primitives.ButtonBase.OnClick() at System.Windows.Controls.Button.OnClick() at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at AvalonDock.MVVMTestApp.App.Main()

Demo Projects

Controls

Layout Models

Interfaces

Class Designs

Bugs

Manual Tests

Clone this wiki locally