问题描述
@Buu Nguyen
解决方案是基于你的想法
@Buu Nguyen
Hi, solution is based on your idea
我有TPL编程的问题。
我得到UnobservedTaskException,im使用@ h4165f8ghd4f854d6f8h解决方案在 [ ] 来处理异常,但是仍然得到UnobservedTaskException。
我在启动任务之前也放置以下代码:
I having problems with TPL programming.
Im getting UnobservedTaskException, im using @h4165f8ghd4f854d6f8h solution on [ A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was ] to handle exceptions but still getting UnobservedTaskException.
I put the following code before start tasks too:
TaskScheduler.UnobservedTaskException += (sender, e) =>
{
e.SetObserved();
throw e.Exception;
};
但[
I put the solution on question body.
The solution was based on How to handle all unhandled exceptions when using Task Parallel Library?
这篇关于UnobservedTaskException被抛出,但是它由TaskScheduler.UnobservedTaskException处理程序处理,并且继承OnlyOnFaulted处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!