Debugging

  • Thread starter Thread starter John
  • Start date Start date
J

John

Is there a way in visual studio.net to stop at the line which has the error
so the program doesnt go into the 'catch' routines?
 
John said:
Is there a way in visual studio.net to stop at the line which has the
error so the program doesnt go into the 'catch' routines?
Perhaps I don't understand your situation, but breakpoints allow execution
to stop at any designated executable statement, then wait for user commands.
Have you tried putting a breakpoint at the beginning of the try block, then
stepping through the code manually until the exception is raised? Once
you've identified the culprit statement, you can relocate the breakpoint to
that statement and rerun, stopping just before the exception is raised.
 
Peter van der Goes said:
Perhaps I don't understand your situation, but breakpoints allow execution
to stop at any designated executable statement, then wait for user
commands. Have you tried putting a breakpoint at the beginning of the try
block, then stepping through the code manually until the exception is
raised? Once you've identified the culprit statement, you can relocate the
breakpoint to that statement and rerun, stopping just before the exception
is raised.

The error doesnt happen until around 1000 iterations of my function. If I
have wrapped my code in a try/catch statement then the catch is always
executed and I do not see the exact line the error happens on. If I could
turn off the try/catch without removing it from code then the running code
would stop at the exact line with the error without me having to mess about
with breakpoints etc. I was just wondering if this was possible as I cannot
find a way to do this.

Cheers.
 
Peter van der Goes said:
The error doesnt happen until around 1000 iterations of my function.
If I have wrapped my code in a try/catch statement then the catch is
always executed and I do not see the exact line the error happens on.
If I could turn off the try/catch without removing it from code then
the running code would stop at the exact line with the error without
me having to mess about with breakpoints etc. I was just wondering if
this was possible as I cannot find a way to do this.

Cheers.

Try this:

Debug | Exceptions... - Click Common Language Runtime Exceptions, and
then set 'Break into the debugger' in the When the exception is thrown
panel.

Eric Minkes
Trisential
 
I had the same problem once (with 30000 rows in a db table). Finally, I
created a log file and wrote out every single UPDATE (or INSERT) statement I
was sending to sql. Turned out to be a NULL character ( \0 ) in one of the
records. The only way I found it was to log the sql statements. It's handy
because the last line in the log file is always the one causing the problem
:)

Scott
 
Back
Top