none
What are the default exception settings for Visual Studio 2017, there has to be more than 3, right? RRS feed

  • Question

  • So, I'm in a debugging session and my screen is jumping all over the place. This is when I realize it's because exceptions aren't being caught that should be. In this case, an InvalidCastException. So, I know to select this in the 'Exception Settings' window. But when I get there I see there are only 3 exceptions checked out of...what...a 100 or so? So, I go into Tools->Import and Export Settings->Reset all settings. I'm thinking this will fix the problem. It doesn't. There are still only 3 exceptions checked by default out of about 100 or so. I know this cannot be the default settings. What could be wrong here?

    How many C# exceptions are checked by default in Visual Studio 2017?

    Wednesday, November 6, 2019 3:27 PM

All replies

  • It depends on what you mean by checked. Exceptions, when running in the debugger, go through 2 passes. The first pass (first chance exception) occurs at the point the exception is actually thrown. The debugger is notified before exception handling kicks in so at this point you are on the line with the throw and the exception is about to be processed. The second pass occurs (second chance exception) only if the exception is not handled. In this case, outside the debugger, the app is going to crash. The debugger is notified so it can let you know it is about to crash your app.

    This gives the debugger 3 options for working with exceptions: ignore them altogether, break on the first chance or break on the second chance. By default the debugger is going to let all the exceptions be handled so the default is break on second chance. Hence the exception settings don't show you these. In VS 2017 you only see the ones that get caught on first chance as they are almost always fatal errors. In previous versions you'd see all the exception and have to scan through them. So out of the box you're just seeing the exceptions that break into the debugger when thrown. Any unhandled exception will break into the debugger automatically.


    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, November 6, 2019 4:01 PM
    Moderator
  • Hi friend,

    Welcome to MSDN forum.

    You could click "restore the list to default settings" in Exception Settings window.

    And the Tools/../Reset all settings just restores the environment settings, you could check them in Export Settings page. And it doesn't contain Exception settings window.

    Hope it could help you.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Thursday, November 7, 2019 2:09 AM