I'm using an open-source framework named SoapBox which is for building extensible applications using MEF and WPF with the MVVM. You can get more information about this framework through following links:
Building an Extensible Application with MEF, WPF, and MVVM
I get the following error when I close view containing DockingManager:
"An unhandled exception of type 'System.StackOverflowException' occurred in PresentationFramework.dll"
But I couldn't reproduce the error without using the SoapBox framework. It must be related with the MEF way of exporting views through ResourceDictionaries using DataTemplates. But I couldn't figure out why and I'm really stuck. I have to use the DockingManager but I can't find a work around. I need an immediate workaround for the problem.
I've tried to minimize the framework and attached a sample which shows the error. When you run the application there will be a tab name 'View with no error" (created in LayoutManagerView.xaml). Select the tab and close it. You won't see the error since it isn't created through MEF. But when you click the menu item View\High Scores, on the App tab the same view will be created through MEF (HighScoresView.xaml and HighScoresView.xaml.cs). When you close this view you should get be getting the error.
And I figured out that the problem comes from the bottom docked panes (Pane1, Pane2 and Pane3). When I remove the TargetNameInDockedMode="pane1" statement for Pane2 and Pane3 I don't get the error. When you open the solution please add Syncfusion.Core.dll and Syncfusion.Tools.WPF.dll's to lib folder.
I hope my sample helps someone to figure out the problem. I really, really need an immediate workaround for the solution without changing the layout in DockingManager.
Thanks in advanceSoapBox_Syncfusion_c288aece.zip