When you run an application from Visual Studio for debugging, the application will pause (or "break") when an exception is not handled by your application. However, the place where the application breaks may not be the same place where the exception occurred.
In some cases, the application may even crash silently without breaking at all. This makes it very difficult to find the source of the problem. Ideally, we'd like Visual Studio to break the application as soon as the exception is thrown.
By default, Visual Studio doesn't do this for all exceptions, but there is a way to change this. Open the "Exception Settings" window by going to Debug > Windows > Exception Settings.
In the Exception Settings window, you'll see a list of exception categories (e.g., "Common Language Runtime Exceptions"). Inside each category, you'll see a list of individual exceptions. The easiest way to break on all exceptions is to simply check every category.
If your application throws an exception, Visual Studio will now break at the place where the exception was thrown (whether or not it was caught). If you're using a third-party library and it throws an exception, your application will break at the line of code that called the third-party library.
Your application may start breaking more often than you expected. Again, this is because even exceptions that are handled (i.e., "caught") will cause your application to break at that point. However, the exception window that pops up gives you the option to uncheck breaking on that specific kind of exception. You can then continue running your application.
For those of you running a standalone ESAPI application, don't be surprised if your application breaks at several exceptions thrown by ESAPI. These are handled internally by ESAPI and it's the normal behavior. Simply uncheck breaking on those exceptions, and you won't break on them the next time you run your application.