This project is read-only.

DockingManager crash : exception thrown from floatingWindow.Show()

Jun 28, 2011 at 11:06 AM

I use Avalon dock in a projet and I encountered a crash with the DockingManager.

I was able to reproduce the behavior (and the crash) with AvalonDock.DemoApp following these steps :

- Launch the demo

- Right click on the "NestedDockingManager" tab

- Choose "Float" to move it to a floating window

- Right click on the "InnerContent1" tab

- Choose "Float"

- Right click on the "NestedDockingManager" window's header

- Choose "Dock as Tabbed Document" -> crash with InvalidOperationException


Is there already an Issue opened or does someone have a fix for this ?

Oct 31, 2011 at 9:38 PM

I get the same problem. Did you ever get a solution?

I don't need tabbed documents and would be happy if I could just disable or remove that menu item.


Nov 22, 2011 at 3:34 PM
Edited Nov 25, 2011 at 8:42 PM

I see the problem described above in change set 76560 and I think I found a related problem that is reproducible using the DemoApp:

- Launch the demo and drag the NestedDockingManager tab off.

- Unpin the InnerContent1 control.

- Mouse over the InnerContent1 tab and click on empty space somewhere in the flyout to temporarily lock open the flyout.

- Drag the NestedDockingManager window back to where it was and drop it.

- Error:

FatalExecutionEngineError was detected
Message: The runtime has encountered a fatal error. The address of the error was at 0x5f3c8fed, on thread 0x8b4. The error code is 0x80131623. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

(I am using change set 76560 - Apr 21 2011)

The error occurs at line 145 in OnItemsChange.pane.cs:    parentPanel.InvalidateMeasure();

EDIT: Actually the error pointer is pointing to the statement after the error and the error occurs on the preceding line - 144:  parentPanel.UpdateLayout();
In DockableTabPanel.MeasureOverride the exception is thrown at line 48: return base.MeasureOverride(availableSize);

The traceback looks like:

OnItemsChanged.DockablePane.cs line 121:   base.OnItemsChanged(e);

(External Code)

RestoreOriginalPane.FlyoutDocakablePane.cs line 80:   _referencedPane.Items.Insert(_arrayIndexPreviousPane, RemoveContent(0));

After looking at this briefly, this makes me think that the FlyoutDockablePane is trying to insert the InnerContent1 DockableContent into the original pane causing the failure when the DockablePane attempts to resize the DockableContent.

I'll try to look further at these issues, but as I am very new to AvalonDock and relatively new to WPF it will be a slog for me and I have other several other projects pulling at me.  I can live without nested DockingManagers, but they are a more elegant solution than the alternative I was originally working on.


Nov 26, 2011 at 11:46 PM
Edited Nov 26, 2011 at 11:58 PM

OK, I'm pretty sure I know what causes the crash described by tbayart and I strongly suspect it causes my issue as well, but haven't traced it yet.

When a floating NestedDockingManager is re-docked to its parent container the floating window that was holding it is closed without first transferring the ownership of its child windows ( i.e. the floating window for the InnerContent1 pane) to what should be the new parent window.  Hence when the NestedDockingManager's floating window is closed all its child windows are closed and attempts to Show or UpdateLayout for the closed floating window (in this case for the InnerContent1) causes problems.

It seems to me the ownership of any child floating windows should be transferred to the new parent window before closing the the NestedDockingManager's floating window, or perhaps they should have their owner window set initially to the ubber-parent window rather than to the NestedDockingManager's floating window.  I don't know which which would be the better solution and I don't feel confident enough in my understanding of AvalonDock to make the changes required.  I hope somebody else can come up with an appropriate fix.  (Or, if necessary, disabuse me of any misunderstanding I may have.)