我已经在VS调试异常对话框中设置了ThreadAbortException,但它从未中断,即使我在代码中显式地使用Thread.Abort()。
我可以在控制台中看到如下条目:
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in System.dll
An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code有没有办法让VS打破这些异常?(我在台式机上使用VS Express 2012,但如果需要,可以访问完整的VS )
发布于 2014-01-31 02:27:13
Redirect()调用End(),后者在完成时抛出ThreadAbortException异常。这是此类异常的一个来源。
要在异常时中断,请选择Debug->Exceptions,对于Common Language Runtime Exception,在抛出的列中放置一个复选标记。
您可以通过在控制台应用程序中运行此示例代码来验证您的设置是否正确。调试器应在线程中止的点处暂停。
using System.Threading;
using System.Threading.Tasks;
namespace AbortThread
{
class Program
{
static void Main( string[] args )
{
Task.Run( () => Thread.CurrentThread.Abort() );
}
}
}https://stackoverflow.com/questions/17408748
复制相似问题