This is about how thread interruption works:
try {
try {
try {
Thread.CurrentThread.Abort();
} catch(Exception e) {
Console.WriteLine(e.GetType());
throw new Exception();
}
} catch(Exception e) {
Console.WriteLine(e.GetType());
}
} catch(Exception e) {
Console.WriteLine(e.GetType());
}
This code prints:
System.Threading.ThreadAbortException
System.Exception
System.Threading.ThreadAbortException
So, when your custom exception is handled ThreadAbortException, that will be re-inserted.
ThreadAbortException- A special exception that can be caught by the application code, but re-selected at the end of the block catch, if not called ResetAbort. MSDN
source:
private void Execute()
{
if (IsSelfReplicatingRoot)
{
ExecuteSelfReplicating(this);
}
else
{
try
{
InnerInvoke();
}
catch (ThreadAbortException tae)
{
if (!IsChildReplica)
{
HandleException(tae);
FinishThreadAbortedTask(true, true);
}
}
catch (Exception exn)
{
HandleException(exn);
}
}
}
, ThreadAbortException . ThreadAbortException TimeoutException, . , , ThreadAbortException , .