Search code examples
vb.netformsfreezedockpaneldockpanel-suite

WeifenLuo DockPanel Suite Form Freeze on Close


recently I decided to implement the WeifenLuo DockPanel Suite into my VB.NET application. Everything works fine, until you try and close the application, where it then freezes. Nothing happens.

I tried:

  • Disposing of the DockPanel before closing
  • Using Application.Exit()
  • RunningApplication.DoEvents() before closing
  • Closing any open DockPanel forms before closing.
  • Running the application outside of the Visual Studio Debugger.
  • Setting Visual Studio to target x86 instead of AnyCPU
  • Upgrading/Downloading the DockPanel Suite framework version

Yet still nothing,t still simply freezes.

The output shows the following messages:

The thread 0x1f34 has exited with code 259 (0x103).
The thread 0x22b8 has exited with code 259 (0x103).

With the thread names being different each time. However I don't have any threads running.

This only occurs on the form with the DockPanel.

Any thoughts? I can't find anyone else with this issue online, and it is really frustrating.

Thanks.


Solution

  • In the form closing event of my application, I iterated through any open documents in the DockPanel using:

    While i < DockPanel1.ActiveDocumentPane.Contents.Count
            Dim dockContent As IDockContent = DockPanel1.ActiveDocumentPane.Contents(i)
            dockContent.DockHandler.Close()
    End While
    

    This is what was causing the application to freeze. To fix this, I replaced the code with this:

    For Each item As DockContent In DockPanel1.Documents
            item.DockHandler.Close()
    Next