Thread.Abort()
injects a ThreadAbortException
on the thread. The thread may cancel the request by calling Thread.ResetAbort()
. Also, there are certain code parts, such as finally
block that will execute before the exception is handled. If for some reason the thread is stuck in such a block the exception will never be raised on the thread.
As the caller has very little control over the state of the thread when calling Abort()
, it is generally not advisable to do so. Pass a message to the thread requesting termination instead.