![解决错误 Cannot await in the body of a catch clause 解决错误 Cannot await in the body of a catch clause](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
解决错误 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(); } } |