Home  |  Index  |  Dotnet4all Snippets  |  Submit resources
About  |  Mail us  
Dotnet4all Logo
Basic debugging (Tuesday, September 14, 2004)
 

Found the following interesting discussion in the Newsgroups:

basic debugging question
by: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



 Reply:
by: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


 Reply:
by: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.



Posted by Xander Zelders



 
Previous Posts
    - Example for class that Inherits System.IO.Stream
    - VB.NET startup icon
    - Click Events for Images at Run-Time
    - FileSystemWatcher Event problem
    - OnComm Events
    - System Hook
    - Datagrid and 12:00:00
    - Call External Program
    - Quotation Mark in string
    - How to print with vb.net

Archives
    - 08/01/2004 - 08/08/2004
    - 08/08/2004 - 08/15/2004
    - 08/15/2004 - 08/22/2004
    - 08/22/2004 - 08/29/2004
    - 08/29/2004 - 09/05/2004
    - 09/05/2004 - 09/12/2004
    - 09/12/2004 - 09/19/2004
    - 09/19/2004 - 09/26/2004
    - 09/26/2004 - 10/03/2004
    - 10/03/2004 - 10/10/2004
    - 01/02/2005 - 01/09/2005
    - 01/09/2005 - 01/16/2005
    - 01/30/2005 - 02/06/2005
    - 01/01/2006 - 01/08/2006


Disclaimer & Terms of Use  | DotNet4All.Com concept & © 2004 - 2007 by  Zelders²  - Holland