我从“Windows 上的并发编程”一书中得到以下代码:
void Main()
{
try
{
try
{
Console.WriteLine("Inside Main Method");
Thread.CurrentThread.Abort();
}
catch(ThreadAbortException)
{
Console.WriteLine("Inside First Catch");
// Trying to swallow but CLR throws it again....
}
}
catch(ThreadAbortException)
{
Console.WriteLine("Inside Second Catch");
//Thread.ResetAbort();
}
}
我很想知道为什么 CLR 会重新抛出 ThreadAbortException ?它一直这样做,直到我调用“Thread.ResetAbort()”。其次,是否有任何其他系统定义的异常,从 CLR 得到特殊处理?