How can I make VS break on exceptions in an async Task, without breaking on all exceptions?

前端 未结 5 765
小蘑菇
小蘑菇 2021-02-01 15:06

As indicated here and here, exceptions occuring in an async Task are technically not unhandled.

This is particularly nasty when working with MVC. It actually took us a w

5条回答
  •  你的背包
    2021-02-01 15:45

    You could try and listen for this event if nothing else works here

    AppDomain.CurrentDomain.UnhandledException
    

    or

    AppDomain.CurrentDomain.FirstChanceException
    

    Then you need to put some if-constructs (check what sender for example) to hit your breakpoint only when it makes sense.

提交回复
热议问题