xceedsoftware / wpftoolkit

All the controls missing in WPF. Over 1 million downloads.
Other
3.91k stars 878 forks source link

System.InvalidOperationException when window docking #1310

Open tmyt opened 6 years ago

tmyt commented 6 years ago

I got System.InvalidOperationException: Cannot set Visibility or call Show, ShowDialog, or WindowInteropHelper.EnsureHandle after a Window has closed. when float pane and dock pane and I got this stack trace.

[External Code] 
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.Controls.LayoutFloatingWindowControl.InternalClose() Line 480 C#
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.Controls.LayoutFloatingWindowControl.OnUnloaded(object sender, System.Windows.RoutedEventArgs e) Line 265 C#
[External Code] 
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.Controls.LayoutFloatingWindowControl.InternalClose() Line 480 C#
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.Controls.LayoutAnchorableFloatingWindowControl._model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) Line 147   C#
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.Layout.LayoutElement.RaisePropertyChanged(string propertyName) Line 101   C#
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.Layout.LayoutAnchorableFloatingWindow.RootPanel.set(Xceed.Wpf.AvalonDock.Layout.LayoutAnchorablePaneGroup value) Line 58  C#
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.Layout.LayoutAnchorableFloatingWindow.RemoveChild(Xceed.Wpf.AvalonDock.Layout.ILayoutElement element) Line 112    C#
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.Layout.LayoutRoot.CollectGarbage() Line 495   C#
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.Controls.DragService.Drop(System.Windows.Point dropLocation, out bool dropHandled) Line 158   C#
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.Controls.LayoutFloatingWindowControl.FilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Line 423    C#
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.Controls.LayoutAnchorableFloatingWindowControl.FilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Line 282  C#
[External Code] 
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.Controls.LayoutFloatingWindowControl.OnActivated(object sender, System.EventArgs e) Line 285  C#
[External Code] 
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.DockingManager.StartDraggingFloatingWindowForPane(Xceed.Wpf.AvalonDock.Layout.LayoutAnchorablePane paneModel) Line 1696   C#
Xceed.Wpf.AvalonDock.dll!Xceed.Wpf.AvalonDock.Controls.AnchorablePaneTitle.OnMouseLeave(System.Windows.Input.MouseEventArgs e) Line 148 C#
[External Code] 

It cause seems to call InternalClose twice. I change InternalClose to that, the problem seems fixed.

internal void InternalClose()
{
  if (_internalCloseFlag) return;
  _internalCloseFlag = true;
  Close();
}
XceedBoucherS commented 6 years ago

Hi, This is already fixed in v3.5 and up

Currently, -Users of Toolkit from GitHub have v3.3 -Users of Toolkit Plus from Xceed have v3.6, available here : https://xceed.com/xceed-toolkit-plus-for-wpf/

Users of Toolkit Plus from Xceed always have the latest release and more features.