Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB.Net - Finding Line Where Exception Occurred

Posted on 2014-01-15
3
Medium Priority
?
209 Views
Last Modified: 2014-03-04
Good Day Experts!

I am trying to figure out where an errorr is occuring in my code when I receive an error.  
I have the traditional Try/Catch/Finally block setup with an exception messagebox.

When I receive this messagebox,  is there a way to get the code to "break" back to the line of code that the error happened?  

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 1000 total points
ID: 39782818
You cannot break back, but you can break before.

Set a breakpoint on the first line after the Try by clicking in the grey margin on the left of the line or by hitting F9 when the cursor is on the line.

Make sure that you are on Debug mode (not Release) in the Toolbar.

When execution arrive on that line, it will fall in the debugger. Move through the code with F10, and note the last line that executes before jumping into the Catch. That is where the error occurs.

If you cannot find out what the problem is, it might be that this line calls another method that is causing the error. In such case, start moving with F11 before executing that line instead of F10 so that you can go into the called method with the debugger.
0
 
LVL 15

Assisted Solution

by:David L. Hansen
David L. Hansen earned 1000 total points
ID: 39782844
There is likely a stacktrace component in your exception object (the "ex" object in the catch block).  Put a breakpoint on the first line inside the catch block and when it hits that just hover your mouse over the "ex" variable and look for the stacktrace (I'd copy the text of it and paste it into a text-editor, then search for the word "line" within what you paste).  Also, just turning on "StackTrace" in your debugger and using that is helpful too.

This may help...even if you are running an older version of VS
http://msdn.microsoft.com/en-us/library/dn194476.aspx
or
Type Ctrl+alt+C while in the debugger
or
In the menu go to: Debug->Windows->CallStack
0
 

Author Comment

by:Jimbo99999
ID: 39786775
Thanks you for your reponses. I will try them out.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question