From: JPK on
When debugging in VS, and instead of exiting the app normally, you click the
Stop debugging button, the app is killed, and the usual Form Closing/Closed,
events are not called. Is there some event or way to trap this event or is
it impossible?

Thanks,

JIM

From: Peter Duniho on
On Wed, 16 Sep 2009 08:48:41 -0700, JPK <james(a)klett.us> wrote:

> When debugging in VS, and instead of exiting the app normally, you click
> the Stop debugging button, the app is killed, and the usual Form
> Closing/Closed, events are not called. Is there some event or way to
> trap this event or is it impossible?

It's impossible. It's the same as the user using Task Manager or similar
to simply kill the process. The process itself has no say in the matter.
It just goes away.
From: JPK on
Hmm, may MS should add one at least for VS debugging because there is no way
to remove the app try icon unless you move the mouse over it. I get a dozen
built up and then I eventually manually make them go away by moving the
mouse to each one


"Peter Duniho" <no.peted.spam(a)no.nwlink.spam.com> wrote in message
news:op.u0c1axeqvmc1hu(a)macbook-pro.local...
> On Wed, 16 Sep 2009 08:48:41 -0700, JPK <james(a)klett.us> wrote:
>
>> When debugging in VS, and instead of exiting the app normally, you click
>> the Stop debugging button, the app is killed, and the usual Form
>> Closing/Closed, events are not called. Is there some event or way to
>> trap this event or is it impossible?
>
> It's impossible. It's the same as the user using Task Manager or similar
> to simply kill the process. The process itself has no say in the matter.
> It just goes away.

From: Peter Duniho on
On Wed, 16 Sep 2009 11:00:56 -0700, JPK <james(a)klett.us> wrote:

> Hmm, may MS should add one at least for VS debugging because there is no
> way to remove the app try icon unless you move the mouse over it. I get
> a dozen built up and then I eventually manually make them go away by
> moving the mouse to each one

I don't know what the point would be. Are you suggesting you would write
code in your program that would be intended soley for the purpose of
clean-up after a debugging session? In what way would that benefit your
users?

The task tray thing is a little annoying, to be sure. I wish Windows
would track what process goes with what icon and just remove them
automatically when the process goes away (whether killed or not). But,
there's a fundamental need for the act of killing a process to simply
immediately stop the process; providing a hook or other mechanism for that
process to execute any code at all before it's forcibly terminated would
negate one of the main points of terminating a process in the first place:
to get it to immediately stop whatever it is it's doing.

Pete
From: Jeff Johnson on
"Peter Duniho" <no.peted.spam(a)no.nwlink.spam.com> wrote in message
news:op.u0c3r4qnvmc1hu(a)macbook-pro.local...

> But, there's a fundamental need for the act of killing a process to simply
> immediately stop the process; providing a hook or other mechanism for that
> process to execute any code at all before it's forcibly terminated would
> negate one of the main points of terminating a process in the first place:
> to get it to immediately stop whatever it is it's doing.

Someone in another group once wrote a rather graphic analogy when this
question was posed (mainly about writing debug logs during shutdown): When
you put a gun in your mouth and blow your brains out, it's a little hard to
compose your last will and testament while you're falling to the ground.