I have an addin for ArcMap 10.2 that has a dockable window. For what it's worth, this dockable window has a DataGridView to which the user can add features for review. These features are added from other buttons and menus that are part of the addin. All of that works fine, as long as the dockable window is not showing when the MXD is loaded.
However, if the dockable window is showing at startup (for example, if the user left it open and saved their MXD at the end of the last session), then I am unable to access the dockable window (or add data to the dockable window), and I get a Null Reference Exception. I assume that there is an already existing copy of the dockable window class somewhere (since the dockable window is visible in ArcMap), but I'm at a loss on how to access it.
I've tried using the DockableWindowManager to get a reference to the dockable window and then close it; I've also tried to see if an existing copy of the class can be found using Marshal.GetActiveObject. Neither of these solve my problem.
Is there a way to get a reference to an existing copy of a dockable window class that I can use?