解决错误 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();

}

}

相关文章:

  • 2021-12-19
  • 2022-12-23
  • 2021-09-10
  • 2021-12-21
  • 2021-06-01
  • 2022-12-23
猜你喜欢
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2021-10-31
  • 2021-05-23
  • 2021-12-24
相关资源
相似解决方案