How can I allow Task exceptions to propagate back to the UI thread?

后端 未结 4 810
一生所求
一生所求 2021-02-08 11:43

In TPL, if an exception is thrown by a Task, that exception is captured and stored in Task.Exception, and then follows all the rules on observed exceptions. If it\'s never obser

4条回答
  •  忘掉有多难
    2021-02-08 12:37

    There's no way that I'm aware of to have these exceptions propagate up like exceptions from the main thread. Why not just hook the same handler that you're hooking to Application.ThreadException to TaskScheduler.UnobservedTaskException as well?

提交回复
热议问题