Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Exception "Hwnd of zero is not valid" when loading layout.
posted

I save the docking manager layout with

            using (var fs = new FileStream(@"Data\XDMLayout.xml", FileMode.Create, FileAccess.Write))
            {
                dockingManager.SaveLayout(fs);
            }

and load with

                using (var fs = new FileStream(@"Data\XDMLayout.xml", FileMode.Open, FileAccess.Read))
                {
                    dockingManager.LoadLayout(fs);
                }

and everything goes well, until I change one of the panes to floating. After saving and attempting to load I have the exception below. Can Infragistics please help?

System.ArgumentException was unhandled

  Message=Hwnd of zero is not valid.
  Source=PresentationCore
  StackTrace:
       at System.Windows.Interop.HwndSource.CriticalFromHwnd(IntPtr hwnd)
       at System.Windows.Interop.HwndSource.FromHwnd(IntPtr hwnd)
       at Infragistics.Windows.Controls.ToolWindowHostWindow.OnSourceInitialized(EventArgs e)
       at System.Windows.Window.CreateSourceWindowImpl()
       at System.Windows.Window.SafeCreateWindow()
       at System.Windows.Window.ShowHelper(Object booleanBox)
       at System.Windows.Window.Show()
       at Infragistics.Windows.Controls.ToolWindowHostWindow.Show(Boolean activate)
       at Infragistics.Windows.Controls.ToolWindow.ShowInToolWindowHostWindow(Boolean activate, Window owningWindow)
       at Infragistics.Windows.Controls.ToolWindow.ShowImpl(FrameworkElement owner, Boolean activate)
       at Infragistics.Windows.Controls.ToolWindow.Show(FrameworkElement owner, Boolean activate, Boolean preferPopup)
       at Infragistics.Windows.DockManager.DockManagerUtilities.ShowToolWindow(ToolWindow window, FrameworkElement owner, Boolean activate)
       at Infragistics.Windows.DockManager.PaneToolWindow.set_IsWindowLoaded(Boolean value)
       at Infragistics.Windows.DockManager.XamDockManager.SetIsWindowLoaded(Boolean loaded)
       at Infragistics.Windows.DockManager.XamDockManager.OnAfterLoadLayout()
       at Infragistics.Windows.DockManager.LayoutManager.LoadLayout(XamDockManager dockManager, Stream stream)
       at Infragistics.Windows.DockManager.XamDockManager.LoadLayout(Stream stream)
       at ***Shell.LoadLayout() in C:\***Shell.xaml.cs:line 62
       at ***Shell.XamRibbonWindowLoaded(Object sender, RoutedEventArgs e) in C***Shell.xaml.cs:line 23
       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.RaiseEvent(RoutedEventArgs e)
       at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
       at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
       at MS.Internal.LoadedOrUnloadedOperation.DoWork()
       at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
       at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
       at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
       at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
       at System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget)
       at System.Windows.Interop.HwndTarget.OnResize()
       at System.Windows.Interop.HwndTarget.HandleMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(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, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at Infragistics.Windows.Ribbon.NativeWindowMethods.SetWindowRgn(IntPtr hWnd, IntPtr hRgn, Boolean bRedraw)
       at Infragistics.Windows.Ribbon.NativeWindowMethods.SetWindowRgnApi(IntPtr hWnd, IntPtr hRgn, Boolean bRedraw)
       at Infragistics.Windows.Ribbon.XamRibbonWindow.UpdateWindowClipRegion(IntPtr newRegion, IntPtr hwnd)
       at Infragistics.Windows.Ribbon.XamRibbonWindow.UpdateWindowClipRegion(IntPtr newRegion)
       at Infragistics.Windows.Ribbon.XamRibbonWindow.UpdateWindowClipRegion()
       at Infragistics.Windows.Ribbon.XamRibbonWindow.OnSourceInitialized(EventArgs e)
       at System.Windows.Window.CreateSourceWindowImpl()
       at System.Windows.Window.SafeCreateWindow()
       at System.Windows.Window.ShowHelper(Object booleanBox)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(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, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
       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.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.Run()
       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 ***App.Main() in ***\obj\x86\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(Assembly 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.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

Here is the content of XDMLayout.xaml:

 

<?xml version="1.0" encoding="utf-8"?>
<xamDockManager version="10.3.20103.1003">
  <contentPanes>
    <contentPane name="actionButtonsPanel" location="DockedTop" lastFloatingSize="131,247" lastFloatingWindowRect="1900,112,139,273" lastFloatingLocation="1900,112" lastActivatedTime="2011-06-01T22:50:24.4902884Z" />
    <contentPane name="summaryPanel" location="Floating" lastFloatingSize="344,144" lastFloatingWindowRect="913,359,352,170" lastFloatingLocation="913,359" lastActivatedTime="2011-06-01T22:50:22.7098136Z" />
    <contentPane name="parentsPanel" location="DockedBottom" lastFloatingSize="404,254" lastFloatingWindowRect="621,726,412,280" lastFloatingLocation="621,726" lastActivatedTime="2011-06-01T20:42:01.0927828Z" />
    <contentPane name="childrenPanel" location="DockedBottom" lastFloatingSize="268,516" lastFloatingWindowRect="656,779,276,542" lastFloatingLocation="656,779" lastActivatedTime="2011-06-01T20:40:48.9366988Z" />
  </contentPanes>
  <panes>
    <splitPane name="Z1747aad9be4b4d23ab1f84ec3539a4e6" splitterOrientation="Vertical" location="DockedTop" extent="91">
      <contentPane name="actionButtonsPanel" />
    </splitPane>
    <splitPane name="Zdf534c8cce224899aedf66e310294466" splitterOrientation="Vertical" location="DockedBottom" extent="533.46333333333337">
      <splitPane name="Z436372777885462f86c76ae31d68657c" splitterOrientation="Horizontal">
        <contentPane name="childrenPanel" relativeSize="100,78.2482093002641" />
        <contentPane name="parentsPanel" relativeSize="100,140.546411243308" />
      </splitPane>
    </splitPane>
    <splitPane name="rootPanel" splitterOrientation="Vertical" location="DockedLeft" />
    <splitPane name="Z1ffa477d24d14c2ea636f237f1d49a2b" splitterOrientation="Vertical" location="Floating" floatingLocation="656,779" floatingSize="268,516">
      <contentPane name="childrenPanel" />
    </splitPane>
    <splitPane name="Zf6225bc0c09846f3bc70a431a122ac74" splitterOrientation="Vertical" location="Floating" floatingLocation="621,726" floatingSize="404,254">
      <contentPane name="parentsPanel" />
    </splitPane>
    <splitPane name="Z1de9884c9ecb4623a75627430d822f4c" splitterOrientation="Vertical" location="Floating" floatingLocation="1900,112" floatingSize="131,247">
      <contentPane name="actionButtonsPanel" />
    </splitPane>
    <splitPane name="Z91d13323fe144f6fac12959fe532653f" splitterOrientation="Vertical" location="Floating" floatingLocation="913,359" floatingSize="344,144">
      <contentPane name="summaryPanel" relativeSize="100,41.9372997787765" />
    </splitPane>
    <splitPane name="Z4c2381d966cd4e099def6257a8480c57" splitterOrientation="Vertical" location="DockedTop" extent="27">
      <contentPane name="summaryPanel" relativeSize="100,41.9372997787765" />
    </splitPane>
  </panes>
</xamDockManager>

Parents Reply Children
No Data