System.InvalidOperationException in Docking Framework

Docking/MDI for WPF Forum

Posted 9 years ago by Gareth Parris - Software Developer, McLaren
Version: 15.1.0622
Platform: .NET 4.5
Environment: Windows 8 (64-bit)

When I drag a docking window I sometimes get the following error from the Actipro Framework.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Cannot modify the logical children for this node at this time because a tree walk is in progress.

at System.Windows.FrameworkElement.RemoveLogicalChild(Object child)
at MS.Internal.Controls.InnerItemCollectionView.ClearModelParent(Object item)
at MS.Internal.Controls.InnerItemCollectionView._RemoveAt(Int32 index, Int32 indexR, Object item)
at System.Windows.Controls.ItemCollection.RemoveAt(Int32 removeIndex)
at ActiproSoftware.Windows.Controls.Docking.DockSite.Replace(DependencyObject control, DependencyObject target, Boolean resetFocus)
at ActiproSoftware.Windows.Controls.Docking.DockSite.Replace(DependencyObject control, DependencyObject target)
at ActiproSoftware.Windows.Controls.Docking.DockSite.ExtractDockingWindow(DependencyObject control)
at ActiproSoftware.Windows.Controls.Docking.DockSite.ExtractVisualContent(DependencyObject control)
at ActiproSoftware.Windows.Controls.Docking.DockSite.RemoveFromDockInDockingWindowContainer(DependencyObject control)
at ActiproSoftware.Windows.Controls.Docking.DockSite.RemoveFromDock(DependencyObject control)
at ActiproSoftware.Windows.Controls.Docking.DockSite.RemoveCore(DependencyObject control)
at ActiproSoftware.Windows.Controls.Docking.DockSite.RestoreToDocked(DependencyObject control, #ki notifier, Direction defaultDock, IList'1 windows)
at ActiproSoftware.Windows.Controls.Docking.DockSite.RestoreToDocked(DependencyObject control, #ki notifier, Direction defaultDock)
at ActiproSoftware.Windows.Controls.Docking.DockSite.Restore(DependencyObject control, Direction defaultDock, Nullable'1 hintState)
at ActiproSoftware.Windows.Controls.Docking.DockSite.Restore(DependencyObject control)
at ActiproSoftware.Windows.Controls.Docking.DockSite.Open(DockingWindow window, Boolean activate, Boolean focus)
at ActiproSoftware.Windows.Controls.Docking.DockingWindow.Open()
at MAT.Atlas.Host.Views.PageView.<>c__DisplayClass8_0.<HandlePageDockSiteWindowRegistered>b__0() in C:\dev\ATLAS10\MAT.Atlas.Host\Views\PageView.xaml.cs:line 93
at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke(Action callback)
at MAT.Atlas.Host.Views.PageView.HandlePageDockSiteWindowRegistered(Object sender, DockingWindowEventArgs eventArgs) in C:\dev\ATLAS10\MAT.Atlas.Host\Views\PageView.xaml.cs:line 91


The actual lines of code executed are:

private void HandlePageDockSiteWindowRegistered(object sender, DockingWindowEventArgs eventArgs)
  var dockingWindow = eventArgs.Window as ToolWindow;
  if (dockingWindow == null)
  dockingWindow.Open();                    <<<<< FAILS HERE


Does anyone have any ideas why this works sometimes and not others?

Comments (1)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Gareth,

Thanks for the bug report.  We're not currently aware of any issues in this area and the related code really hasn't changed in years.  We'd need something to debug to look into it further since it could be due to some setup or configuration you are doing that others haven't really done.

Please make a new project that shows it happening, keep it as minimal as possible, and send that to our support address so we can debug it.  Be sure to rename the .zip file of what you send so it doesn't get spam blocked, and reference this thread in the email you send.  Thanks!

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.