Hi,
I was moving a floating window when the below exception occured.
Our application uses multiple top-level windows in different appdomains, and a ribbon with office 2010 style backstage.
Infragistics version is currently 2013.1.
Any insights? Anything we can do to prevent it, since the affected window sometimes hangs afterward and the application must be manually terminated.
App_DispatcherUnhandledExceptionSystem.InvalidOperationException: Cannot set Visibility or call Show, ShowDialog, or WindowInteropHelper.EnsureHandle after a Window has closed. at System.Windows.Window.CoerceVisibility(DependencyObject d, Object value) at System.Windows.DependencyObject.ProcessCoerceValue(DependencyProperty dp, PropertyMetadata metadata, EntryIndex& entryIndex, Int32& targetIndex, EffectiveValueEntry& newEntry, EffectiveValueEntry& oldEntry, Object& oldValue, Object baseValue, Object controlValue, CoerceValueCallback coerceValueCallback, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, Boolean skipBaseValueChecks) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at System.Windows.Data.BindingOperations.SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding) at Infragistics.Windows.Controls.ToolWindowHostWindow.DeferShowHelper.Show(Boolean activate) at Infragistics.Windows.Controls.ToolWindow.DeferredShowInfo.ProcessShow(Boolean cancel) at Infragistics.Windows.DockManager.DockManagerUtilities.ShowToolWindow(ToolWindow window, FrameworkElement owner, Boolean activate) at Infragistics.Windows.DockManager.Dragging.DragManager.CreateFloatingPreviewWindow(Point point, Size size) at Infragistics.Windows.DockManager.Dragging.MoveWindowAction.PerformAction(DragManager dragManager, Boolean isPreview) at Infragistics.Windows.DockManager.Dragging.DragManager.ProcessDragMove(IInputDeviceInfo e, Nullable`1 windowRect) at Infragistics.Windows.DockManager.Dragging.DragManager.StartDrag(FrameworkElement element, Point mouseDownPosition, IInputDeviceInfo e, Boolean processMove, Boolean isWindowDragMode) at Infragistics.Windows.DockManager.Dragging.DragManager.OnPendingDragElementMouseMove(Object sender, MouseEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) 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.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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
We have an OCX in a WindowsFormsHost on each pane to do rendering of different types of images.
Sorry - just saw your latest call stack. Let me read through that and get back to you.
You can post the video but I suspect it won't be enough to figure out how to reproduce the issue. It could be related to the specific elements you have nested within the panes. Perhaps an element is triggering an UpdateLayout during the move and that is causing some deferred operation to be processed synchronously. It could be that some event is being triggered during the show operation (e.g. the Loaded/SizeChanged/IsVisibleChanged/LayoutUpdated/ToolWindowLoaded/etc event) of a control and something that control is doing is contributing to the issue. It could be that the issue is already addressed as a result of a different fix. If it were just timing then in theory you would be able to reproduce it in any project. So without some means of reproducing it or at least narrowing down what is leading to the issue it's going to be difficult to address it. Perhaps you could try testing your application with a trial version of the latest NetAdvantage version. That would at least rule out whether the issue still occurs or not. You might also try on a system that has the latest .net clr to ensure it's not something that was happening in the framework that has been addressed/changed. You might try making a copy of the application and removing/excluding panes to narrow down what is involved in the issue. So I guess the first thing is to find out if the issue still happens with the latest version (of NA and the WPF framework).
This is what seems to be causing the close of the window.
private static void HideToolWindow(ToolWindow toolWindow) { if (toolWindow == null || !toolWindow.IsVisible) return; toolWindow.Close(); }
InfragisticsWPF4.v13.1.dll!Infragistics.Windows.Controls.ToolWindowHostWindow.OnClosing(System.ComponentModel.CancelEventArgs e) Line 334 C# PresentationFramework.dll!System.Windows.Window.WmClose() + 0x88 bytes PresentationFramework.dll!System.Windows.Window.WindowFilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0xc6 bytes PresentationCore.dll!System.Windows.Interop.HwndSource.PublicHooksFilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x68 bytes WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x9b bytes WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x6b bytes WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) + 0x52 bytes WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) + 0x3a bytes WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) + 0x10e bytes WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) + 0xf1 bytes [Native to Managed Transition] [Managed to Native Transition] PresentationFramework.dll!System.Windows.Window.InternalClose(bool shutdown, bool ignoreCancel) + 0xc3 bytes PresentationFramework.dll!System.Windows.Window.Close() + 0x29 bytes InfragisticsWPF4.v13.1.dll!Infragistics.Windows.Controls.ToolWindowHostWindow.CloseHelper() Line 764 C# InfragisticsWPF4.v13.1.dll!Infragistics.Windows.Controls.ToolWindowHostWindow.Infragistics.Windows.Controls.IToolWindowHost.Close() Line 1938 + 0x6 bytes C# InfragisticsWPF4.v13.1.dll!Infragistics.Windows.Controls.ToolWindow.CloseOverride() Line 1572 + 0x20 bytes C# InfragisticsWPF4.v13.1.dll!Infragistics.Windows.Controls.ToolWindow.Close() Line 2686 + 0xd bytes C#
>InfragisticsWPF4.DockManager.v13.1.dll!Infragistics.Windows.DockManager.Dragging.DragManager.HideToolWindow(Infragistics.Windows.Controls.ToolWindow toolWindow) Line 499 + 0xb bytes C#
InfragisticsWPF4.DockManager.v13.1.dll!Infragistics.Windows.DockManager.Dragging.DragManager.HideDropPreview() Line 492 C# InfragisticsWPF4.DockManager.v13.1.dll!Infragistics.Windows.DockManager.Dragging.DragManager.ProcessDragMove(Infragistics.Windows.DockManager.Dragging.DragManager.IInputDeviceInfo e, System.Windows.Rect? windowRect) Line 1848 + 0xc bytes C# InfragisticsWPF4.DockManager.v13.1.dll!Infragistics.Windows.DockManager.Dragging.DragManager.ProcessDragMove(System.Windows.Input.MouseEventArgs e) Line 1514 + 0x7c bytes C# InfragisticsWPF4.DockManager.v13.1.dll!Infragistics.Windows.DockManager.Dragging.DragManager.OnDragElementMouseMove(object sender, System.Windows.Input.MouseEventArgs e) Line 1388 + 0xc bytes C# PresentationCore.dll!System.Windows.Input.MouseEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) + 0x2c bytes PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) + 0x33 bytes PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x44 bytes PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) + 0xce bytes PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args) + 0x73 bytes PresentationCore.dll!System.Windows.ContentElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs args) + 0x3d bytes PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea() + 0x56f bytes PresentationCore.dll!System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs input) + 0x45 bytes PresentationCore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport) + 0x62 bytes PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.ReportInput(System.IntPtr hwnd, System.Windows.Input.InputMode mode, int timestamp, System.Windows.Input.RawMouseActions actions, int x, int y, int wheel) + 0x279 bytes PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(System.IntPtr hwnd, MS.Internal.Interop.WindowMessage msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x1fe bytes PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x6c bytes WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x9b bytes WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x6b bytes WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) + 0x52 bytes WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) + 0x3a bytes WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) + 0x10e bytes WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) + 0xf1 bytes [Native to Managed Transition] [Managed to Native Transition] WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) + 0xb1 bytes WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) + 0x49 bytes WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() + 0x4b bytes PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) + 0x17 bytes PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x6f bytes PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) + 0x26 bytes PresentationFramework.dll!System.Windows.Application.Run() + 0x1b bytes SynergyClient.exe!SynergyECM.Client.UI.SynergyClientApp.Main() + 0x59 bytes C# [Native to Managed Transition] [Managed to Native Transition] mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x6b bytes Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x27 bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x6f bytes mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes [Native to Managed Transition]
We are not trying to close the window in code nor was the user trying to close the window. I have a video that shows what is happening but I can't send you the code for this application. If you want to see the video I can send it to you (it is 4.4MB in size). Seems like a timing issue. If I drag the window slowly out of the tabs to begin it doesn't happen, but if I drag it quickly out of the tabs the exception occurs every time.