【发布时间】:2013-12-11 04:45:43
【问题描述】:
以下是否会捕获 StartNew() 内部发生的异常?好像没有。
try
{
Task.Factory.StartNew(() =>
{
//do something
});
}
catch(Exception ex)
{
//log it
}
【问题讨论】:
-
Will the following catch an exception that occurs inside of StartNew(): 不会。新任务一开始,try 就会退出。