termination of crashed program

  • Thread starter Thread starter Tod Johnson
  • Start date Start date
T

Tod Johnson

Hello,

when the unhandled exception occured the message box will be thrown (and
the .exe will be locked). How can I then detect PID of this appliction
from another application? I could pass the PID if the programm runned
but what should I do if the program is crashed on the loading (e.g.
TypeLoadException)?

I know that I can iterate through all processes using Toolhelp.dll but
is it possible to avoid using this library?

Thank you,
Tod
 
Tod, my suggestion (assuming it is acceptable for your circumstances and
assuming this is in the same context as your previous posts) is to launch
your main app from another one (e.g. the watchdog). You then have the handle
of the process and can waitforsingleobject on it or do whatever else you
wish.

Cheers
Daniel
 
That's easy. You should NEVER allow your application to crash.
Add a top level exception handling and log a crash/restart should you hit
it.
And yes, you can catch TypeLoadException.
You just can't do it in a method TypeLoadException is thrown from (because
it's never JITed due to missing type).
Add one top level method with try/catch and it would work.

If you see native exceptions you can not catch, something's seriously wrong
with your app or you hit a bug in CF.
Please report it so we can fix it. Thanks.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
Back
Top