The uncatchable exception, pt 2

前端 未结 2 1904
无人共我
无人共我 2021-02-07 01:21

Update: I\'ve filed a bug report on Microsoft Connect: https://connect.microsoft.com/VisualStudio/feedback/details/568271/debugger-halting-on-exception-thrown-i

2条回答
  •  长情又很酷
    2021-02-07 02:10

    You can't catch all exceptions. There's a few assumptions in your example. You are, for instance, assuming the exception was raised on the calling thread. Catching unhandled exceptions on other threads depends on which runtimes you're using (console, winforms, WPF, ASP.Net, etc).

    Additionally, calls to System.Environment.FailFast() do not generate any handlable condition - the process is effectively terminated with no chance for intervention.

提交回复
热议问题