I have a Windows Form app that creates a window and monitors for entries in a SQL queue. When something shows up, it spawns a thread that opens another Form that launches another thread to do work that contains an ActiveX control. Once the control is done with its work, I remove it from the form, dispose of it, and call the garbage collector. Then I call Close() using a delegate (because it’s in a thread).
Here’s where the problem starts. On my dev box, everything works; the child-form goes away and I’m left with the main form I started with. However, when I try running it on a Windows 2003 Server box, it doesn’t work. The child-form does not go away. It freezes. I can move it around, but trying to close it brings up the “End Now” dialog (the main form also freezes, and shows “Not Responding” if I click a button).
I tried logging in the ChildForm_FormClosed and I can see the entry in the event log, so it’s getting stuck somewhere between when it thinks it’s closed and when it actually is closed…?
What might be the cause of this?
I thought it might be that the ActiveX control is not installed correctly on the machine, but that part of the app works, and it doesn’t freeze until after the control is already disposed of.
Turns out it was a problem with the 3rd party ActiveX control. It had a bug where it didn’t want to close when told to.