大致有两种方式
1) 调用 Task 的 Wait 方法时使用 try-catch 捕获异常:
2)在 Task 的 ContinueWith 方法中读取 Task 的 Exception 属性:
var testTask = TestAsync(5, -10);testTask.ContinueWith(task =>{ if (task.IsFaulted){Console.WriteLine(task.Exception.GetBaseException()); } else{Console.WriteLine(task.Result); }});