Exception When pinning/unpinning & switching themes

Docking/MDI for WPF Forum

Posted 4 years ago by Justin Klein
Version: 17.1.0310

I'm able to consistently reproduce an exception via a series of pinning/unpinning toolboxes in a docking application, & switching the theme.  I'm assuming you'll probably want a repro solution, but since it takes me a fair bit of time to trim out all the company's proprietary code & simplify things down, I just thought I'd post the info here first, in hopes that it turns out to be an "obvious" issue. first, the full exception:

System.InvalidOperationException: Specified element is already the logical child of another element. Disconnect it first.
at System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
at System.Windows.FrameworkElement.AddLogicalChild(Object child)
at System.Windows.Controls.UIElementCollection.InsertInternal(Int32 index, UIElement element)
at System.Windows.Controls.UIElementCollection.Insert(Int32 index, UIElement element)
at ActiproSoftware.Windows.Controls.Docking.Primitives.AutoHidePopupPanel.set_ToolWindowContainer(ToolWindowContainer #Ld)
at ActiproSoftware.Windows.Controls.Docking.DockHost.OpenAutoHidePopup(ToolWindow toolWindow)
at ActiproSoftware.Windows.Controls.Docking.Logic.LayoutChangeProcessor.BringToFront(DockingWindow #sb, Boolean #an)
at ActiproSoftware.Windows.Controls.Docking.Logic.LayoutChangeProcessor.Activate(DockingWindow #sb, Boolean #an)
at ActiproSoftware.Windows.Controls.Docking.DockingWindow.Activate(Boolean focus)
at ActiproSoftware.Windows.Controls.Docking.Logic.AutoHidePointerProcessor.#1Gj(Object #xhb, Object #yhb)
at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
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)

Here are the exact steps that consistently makes it happen: https://www.screencast.com/t/iFmxyRgnT

1) Unpin the tool container

2) Expand the tool container & set a different theme (this is bound to a property in which the setter assigns ThemeManager.CurrentTheme = value.ToString();)

3) Click on the tool container's tab to expand it again.  Exception happens.  (Sometimes it happens when just hovering over the tool container's tab, without needing to click).



Comments (2)

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

Hi Justin,

That sounds like something we may have fixed already.  Please try this in the main Docking/MDI "Simple IDE" demo:

1) Click "Find & Replace" auto-hidden tab on the right to show it.

2) Click "Theme" button in the main window header and change theme.

3) Click "Find & Replace" auto-hidden tab and see if the exception occurs.

It does not in our latest WIP codebase here.  Please let us know if that repros it, or how you can make it happen in that demo.  Thanks!

Actipro Software Support

Posted 4 years ago by Justin Klein

Yup, I just wenta head & updated from the v17.1.0650 I was using (beta) to the 17.1.0650 on the website, and it appears to be fixed :)

The latest build of this product (v2020.1.1) 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.