The Visual Studio Debugger is one of the developer’s closest friend but befriending VS takes a lot of effort especially if you are just new in using it. I myself took time before I can fully exploit the VS debugging features and I want to share them to you.
You might encounter an application raising an exception and yet the IDE is pointing you to line of code which you think is not the culprit. I had even encountered the debugger pointing to a simple assignment statement. When designing Windows Forms, you might also encounter an exception but the debugger points you to the first lines of your code sheet which are the using statements(C#).
By default, VS is configured to break when an exception is not handled. What we want is for it to break into the line which raises the exception (when an exception is thrown). To do this, go to Debug menu, choose Exceptions (Ctl-Alt-E), choose CLR Exceptions (which is what you are usually concerned with in .NET), configure “When the exception is thrown” to “Break into the debugger” instead of the default “Continue.” It will now point you to the line that really caused the exception to be thrown. You can even choose what types of exceptions to monitor including your custom exception subclasses.
I once advised this tip to a newsgroup inquiry here. This can be a great help for newbies.
Posted
Feb 24 2005, 06:22 PM
by
jokiz