xbo*_*nez 18 c# multithreading exception
如果我有这样的代码:
try
{
Thread t = new Thread(new ThreadStart(wc.LocalRunProcess));
t.IsBackground = true;
t.Start();
}
catch (Exception ex)
{
//do something with ex
}
Run Code Online (Sandbox Code Playgroud)
线程抛出的异常是否t会被catch块捕获?
Dan*_*ite 19
不会.它不会在您的其他线程中捕获任何异常t.你必须在那个线程中捕获它们并适当地处理它们.
但是,我相信AppDomain的UnhandedException事件会报告它.