basic debugging question

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
 
L

Les Smith

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
 
B

Bob

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top