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

前端 未结 5 694
小蘑菇
小蘑菇 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条回答
  •  梦毁少年i
    2021-02-01 15:40

    Enabling "Just My Code" is one way to do this, as suggested here. True, the exceptions are technically not unhandled, but they are unhandled by user code, which gets VS to do the useful thing and show you where the exception occurred.

    See this answer for some screenshots.

    Obviously this setting has other implications (e.g. you can no longer step through framework code), so this may or may not be suitable.

提交回复
热议问题