解决错误 Cannot await in the body of a catch clause
static async Task f() { ExceptionDispatchInfo capturedException = null; try { await TaskThatFails(); } catch (MyException ex) { capturedException = ExceptionDispatchInfo.Capture(ex); }
if (capturedException != null) { await ExceptionHandler();
capturedException.Throw(); } } |