Form not closing after calling Form.Close
<p>We have an application running at a client that is displaying strange behavior. At random times during the day the OK button (which calls the Form.Close method) on certain forms will not cause the Form to close. With that I mean that the user will click the button, in the trace it will display that Form.Close was called but the form will not close. </p>

<p>The strange thing is that the Form itself is still responsive so they can click any button on the form and the code behind the buttons will execute but the form just will not close. </p>

<p>This state lasts for anything between a couple of seconds to a couple of minutes. Then all of a sudden the form will start disposing and disappear. Really strange.</p>

<p>So to recap, the following happens:</p>

<ul>
<li><code>Form.ShowDialog()</code> -> The form displays</li>
<li>User works on form and presses buttons and so forth</li>
<li><code>Form.Close()</code> is called -> The user clicked the close button</li>
<li>An amount of time passes where the form is just waiting to close while still being responsive (In this time the frustrated user hammered the close button a couple of times with no response) </li>
<li>All of a sudden the form disposes and a dialog result is returned from the <code>Form.ShowDialog</code></li>
</ul>

<p>Things to note:</p>

<ul>
<li>I'm not using any type of threading.</li>
<li>At certain times it is reported that the <code>explorer.exe</code> process has stopped on the PC, can this have an impact on a form's behavior? We are scheduling a rebuild of the PC.</li>
</ul>

<p>My question is if anyone is aware of a scenario that can cause the described behavior above?</p>

<p>I'm not an expert at Forms but as I understand it, when you call <code>Form.Close</code>, the form doesn't close instantly, the current method that called Close first finishes and then another process triggers the form to start closing and dispose. </p>

<p>Can this be related to the <code>explorer.exe</code> process not running?</p>

<p>Any insight would be greatly appreciated.</p>

<p>*** Edit</p>

<p>Also note that we can't replicate the issue, it happens randomly at the client.</p>