top of page

Break on All Exceptions

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.

Related Posts

See All

ESAPI Essentials 1.1 and 2.0

A few months ago, I introduced ESAPI Essentials—a toolkit for working with ESAPI (available via NuGet). I've recently added one major feature: asynchronous access to ESAPI for binary plugin scripts. Y

Announcement: ESAPI Subreddit

A few months ago, Matt Schmidt started the ESAPI subreddit. It's another useful resource for finding and discussing ESAPI-related topics. According to the description, This community is to post and di

Dump All Patient Data from ESAPI

If, for whatever reason, you need to dump out all of the data for a patient from ESAPI, there's a quick and dirty way to do it. Well, there are probably several ways to do it, but here's one I've foun

Comments


bottom of page