basic debugging question

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

In code when I'm handling an exception, I'd like to be able to tell the
debugger, if it's attached, to break and then navigate to where the
exception was thrown, which won't be where I break. Is that possible?

Bob
 
Bob,
I don't know how to do what you are asking, except in an add-in, possibly,
but if you just want to know where the line that caused the exception is, do
the following:

In the Solution Explorer, right click on the project, click the Properties
menu option. In the dialog, click on Configuration Properties, Build, and
check the Generate Debugging Information. That will put line numbers in the
PDB. When you get an exception, trap the ex as System.Exception, print out
(msgbox) ex.ToString and you will get the failing line. You can then Set
Next Statement to the offending line to be able to check the status of
variables at the time of the failure.

HTH
Les Smith
http://www.KnowDotNet.com
 
Thanks. You're right, an addin is the way to go. Maybe I can force VS.Net to
break execution on any exception throw, which is where I usually need to
look.
 
Back
Top