'System.ComponentModel.Win32Exception' in WindowsBase.dll

Hi all,
I’ve run into a strange issue in Rhino 6 where I get repeated exceptions when certain forms are closed or reopened. This was occurring with an Eto plugin I’m working on, but I’ve been able to recreate it with the _PluginManager.

Important: I haven’t been able to reproduce this on my second machine, so I assume it’s environment specific. However I have reinstalled Rhino to no avail.

The exception being thrown is:
Exception thrown: 'System.ComponentModel.Win32Exception' in WindowsBase.dll
with the string
'Invalid window handle'

Stack trace:
at MS.Win32.UnsafeNativeMethods.GetWindowText(HandleRef hWnd, StringBuilder lpString, Int32 nMaxCount)

Call stack:

My steps to reproduce are:

  1. Install fresh Rhino 6
  2. Launch Rhino
  3. Ensure no 3rd party plugins are loaded or even referenced in PluginManager
  4. Attach VS debugger
  5. Open _PluginManager
  6. Observe that everything is fine.
  7. Close _PluginManager
  8. Re-open _PluginManager
  9. Select an plugin
  10. Click OK to close _PluginManager
  11. Open _PluginManager again
  12. Observe that lots of Win32Exceptions are being thrown
  13. Mouseover any control, observe that more exceptions are thrown as new controls are are moused-over.

To reproduce with my Eto plugin, the steps are similar but are triggered when closing/reopening the panel, which is also triggered by opening a new document.

These exceptions are very nondescript hence why I’m after some advice as to what in my environment might be causing this, given that I’m not able to reproduce on my second machine. The effects also appear to be negligible, except that the load times for the windows are significantly slower due to all the exceptions.

The diagnostic output and system information is here.


@Trav, can you look into this?

Thanks, taking a look now.

@JohnM any suggestions here. This appears to be a system resource issue or something not being disposed properly.