xceedsoftware / wpftoolkit

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

[2.9.0] AvalonDock crash when undocking into AnchorableFloatingWindow #1095

Open xceedsoftware opened 7 years ago

xceedsoftware commented 7 years ago

hiwatari_seiji[CodePlex]
The situation I have is that at least two anchorables are stacked, and this combound is docked at one of the sides of the application, like:

In my actual application, I get a randomly appearing (but hardly reproducable) case where, when pulling this combound out of the Application (in an AnchorableFloatingWindow):

The window is correctly created, but directly looses its focus (so the dragging abruptly stops). When its header is then clicked (for example to drag the window), the application crashes at:

File: LayoutAnchorableFloatingWindowControl.cs LineNr: 250 Line: _model.Descendents().OfTypeltLayoutAnchorablePanegt().First(p =gt p.ChildrenCount gt 0 ampamp p.SelectedContent != null).SelectedContent.IsActive = true; with: System.InvalidOperationException was unhandled HResult=-2146233079 Message=Sequence contains no matching element Source=System.Core StackTrace: at System.Linq.Enumerable.First[TSource](IEnumerable1 source, Func2 predicate) at Xceed.Wpf.AvalonDock.Controls.LayoutAnchorableFloatingWindowControl.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Booleanamp handled) in LayoutAnchorableFloatingWindowControl.cs:line 250 at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Booleanamp handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Booleanamp 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(MSGamp msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() ########################################################## at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: The failing condition of the LINQ-Query is: p.SelectedContent != null

When the FloatingAnchorableWindow's tab is changed before clicking it's header (e.g. in the above screenshot from Panel2 to Panel3), the error does not appear.

Unfortunately, due to 3.0.0 AvalonDock MVVM binding defect, I can't test this with 3.0.0 The Test-Application used to generate the Screenshots does not produce the error at all.

xceedsoftware commented 7 years ago

hiwatari_seiji[CodePlex]
This behaves a little different, but re-creating the whole situation would be too much work.

I hope this helps.

xceedsoftware commented 7 years ago

BoucherS[CodePlex]
Hi,

This could already be fixed in the latest version (v3.2). Can you submit a sample so we can test this ?

Thanks.

―――― Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF

xceedsoftware commented 7 years ago

hiwatari_seiji[CodePlex]
I just found out what is causing this. I manually synchronized the Anchorable's IsVisible-Property to my ViewModel's IsVisible property. This binding ended up setting (not changing!) the property on the panel, while the combound was dragged out of the application.

I don't know if this can still be considered a bug or a usage error.