Exited Program Won't Die

  • Thread starter Thread starter Laszlo Szijarto
  • Start date Start date
L

Laszlo Szijarto

Thank you in advance for our help.

I have a program that, when the user exits out (X-closes the form), the
progam still appears to be running under Task Manager (Processes). I've
tried all kinds of things, making sure I set all my objects to null in the
form disposal method, etc. Nothing works. Is there something I can do to
make sure this program dies -- i.e., force it to kill off everything out
there?

Thank you,
Laszlo
 
You could use Application.Exit() or Application.ExitThread(), but these are
pretty severe.

I would first make sure that any spawned child threads or processes are
terminated properly. This is usually the most common cause for applications
not terminating.

Also, when you are setting your objects to null or disposing them, remember
to check that any custom objects that you have (that are implementing
IDisposible) do not have code in their Dispose() methods that might be
hanging the application up.

I would start tracing through your form's Dispose() method just to make sure
that everything is getting cleaned up properly.

If you could post your Dispose() method code, that would help too.
--
HTH

Kyril Magnos
"I'm not a developer anymore, I'm a software engineer now!" :-)

| Thank you in advance for our help.
|
| I have a program that, when the user exits out (X-closes the form), the
| progam still appears to be running under Task Manager (Processes). I've
| tried all kinds of things, making sure I set all my objects to null in the
| form disposal method, etc. Nothing works. Is there something I can do to
| make sure this program dies -- i.e., force it to kill off everything out
| there?
|
| Thank you,
| Laszlo
|
|
 
Thank you, I'll try all that. I tried to kill all threads, close all
FileStream objects, etc. I'm thinking that maybe some Interop components
I'm using aren't disappearing. For the time being, I'm running
process.Kill() for the current process, and that seems to wipe everything
out. I know it's severe, but I'm OK with that for now.

Thanks again,
Laszlo
 
Laszlo Szijarto said:
Thank you in advance for our help.

I have a program that, when the user exits out (X-closes the form), the
progam still appears to be running under Task Manager (Processes). I've
tried all kinds of things, making sure I set all my objects to null in the
form disposal method, etc. Nothing works. Is there something I can do to
make sure this program dies -- i.e., force it to kill off everything out
there?

Have you started any extra threads which could be preventing it from
stopping?
 
Hmmm, are you calling Marshal.ReleaseComObject on all your Interop
components immediately (or as soon as you can) after use? That could be the
key.

--
HTH

Kyril Magnos
"I'm not a developer anymore, I'm a software engineer now!" :-)

| Thank you, I'll try all that. I tried to kill all threads, close all
| FileStream objects, etc. I'm thinking that maybe some Interop components
| I'm using aren't disappearing. For the time being, I'm running
| process.Kill() for the current process, and that seems to wipe everything
| out. I know it's severe, but I'm OK with that for now.
|
| Thanks again,
| Laszlo
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top