c# - Ways to kill a running program and how to trap them? -
we have different ways kill running c# program.
- ctrl + c;
- task bar right click icon, select 'close' on popup;
- task manager, select executable name , click end process;
- console window, use kill command;
maybe more.
what asking here how handle them in c# program guarantee c# program exit gracefully when possible. know how trap ctrl + c, don't others. can me? thanks,
the best guarantee have @ code being run @ exit statement.
note though program have run in try
block when use mechanism.
i believe time block inside finally
not executed at:
a
stackoverflowexception
;corrupted state exceptions (from .net 4);
forceful termination through task manager (an unmanaged process kill);
crash of entire system (removing power cable e.g.).
see keep code running reliability features of .net framework in depth analysis.
Comments
Post a Comment