Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Just some thoughts, since this does seem very odd.</p> <p>First, the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.closereason.aspx" rel="nofollow">MSDN documentation</a> is misleading when it states that CloseReason.TaskManagerClosing indicates that "Windows Task Manager is closing the application". It appears, rather, that the CloseReason.TaskManagerClosing is set as the close reason when the window receives a WM_CLOSE message (0x10), which could originate from any process on the system, and not necessarily Task Manager.</p> <p>This raises the question: why is WM_CLOSE being called on these processes? One possibility is that listening for UDP packets is triggering a rule-based filter on the security software (virus/adware), which may show up in the software and Windows event logs around the time the processes are closed. Beyond that, it's difficult to diagnose without knowing the owning process.</p> <p>While it doesn't address the root cause, one practical option is simply to cancel the WM_CLOSE request in response to the FormClosing event.</p> <pre><code> if (e.CloseReason == CloseReason.TaskManagerClosing) e.Cancel = true; </code></pre> <p>Another option is to restructure the software as a Windows service rather than a application. Services tend to be better-suited for server-type applications, since they run in their own user session. But it would also require separating the user interface functionality from the server functionality, and also wouldn't address the underlying problem.</p> <p>Finally, if this is a server, you might want to revisit any installed services or utilities that may be extraneous and somehow sending the WM_CLOSE command to the application instances. In addition, moving the server application instances to a clean server might be a practical approach to isolating the issue.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload