MSDN says, for the Thread.Abort
method-
When this method is invoked on a thread, the system throws a ThreadAbortException in the thread to abort it. ThreadAbortException is a special exception that can be caught by application code, but is re-thrown at the end of the catch block unless ResetAbort is called. ResetAbort cancels the request to abort, and prevents the ThreadAbortException from terminating the thread. Unexecuted finally blocks are executed before the thread is aborted.
So the exception would be thrown only once from the most immediate catch
block, or from all encapsulating catch
blocks ?
Also, when saying unexecuted finally
blocks are executed, does it include both totally unexecuted and partially executed blocks?
The
finally
blocks are always fully protected fromThreadAbortException
both if they are executing and if they would need to be executed during the rollback of the stack.And yes, clearly the
ThreadAbortException
will be automatically re-raised at the end of anytry... catch
block in the same thread that intercepts it, otherwise it would be meaningless. What use would it have to have aThreadAbortException
with only two "lives"?Would it be logical that this could stop a
ThreadAbortException
?while this wouldn't?