Visual Studio 2015 break on unhandled exceptions not working

前端 未结 12 1845
别那么骄傲
别那么骄傲 2020-11-30 23:36

Visual studio used to have a specific checkbox to \"Break on Un-handled exception\". In 2015 this has been removed (or moved somewhere I cannot find it). So now my convert

12条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 23:59

    When I upgraded to VS2015, I also had issues where exceptions used to "break" the application, but are now ignored and passed right over. There are times when we want our code to intentionally throw exceptions in places where we want the code to stop, rather than continue. We always use the phrase Throw New Exception("Message") to get our code to intentionally break:

        If SomethingReallyBad = True Then
            Throw New Exception("Something Really Bad happened and we cannot continue.")
        End If
    

    With VS2015, the classic "System.Exception" is what is thrown when we say Throw New Exception. Therefore, we needed to check the "System.Exception" tick in the new Exception Settings:

    Check the System.Exception Box

    Once checked, our code did as expected.

提交回复
热议问题