I have a form that is closed unexpectedly immediately after showing it. I hooked all the usual events that occur when a form is closed, but none of it is fired (including Closed, Closing, FormClosed, FormClosing, VisibleChanged, Disposed). How can that happen? What can cause a form to disappear without any of the mentioned events firing?
+1
A:
Sounds like a threading issue. My guess is that the form is created on a separate thread, and when the thread dies, the form disappears without a trace.
(That exact behaviour was my introduction to writing thread safe code once upon a time.)
Fredrik Mörk
2009-09-02 14:32:23
Must be the fasted accepted answer ever. You are so right. The creating thread dies shortly after creating the form...
EricSchaefer
2009-09-02 14:34:46