D
Darta
OK- I volunteer to be shot if this question is stupid... BUT, is there
a way to, when you catch an exception in the catch{} handler, resume
to the same line of code that generated an error while you are
debugging within IDE...? Here is an example from VB:
Private SomeFunction ()
On Error GoTo ErrHandler:
MyMethod this, that
Exit Function
ErrHandler:
Err.Raise smth, smth, smth
Exit Function ' this is for safe-keeping, although not necessary
since
' Err.Raise exits the function anyways
Resume
End Function
In VB world, I would set a breakpoint on Err.Raise line, the execution
will stop when error happens on that line, then I would -manually-
drag a cursor to Resume, and then Step Into would bring me to the
exact line that cause the error in the function. This was very handy
and effective as I could immediatelly tell which call caused the error
and with next Step Into, what was the error while debugging. I can't
find a similar way in catch{} statement. You can view the message,
get Source and StackTrace, and all the other stuff from the various
Exception objects, but you have to read all those properties to see
where exactly the error occurred - which is so much slower than the
way I described. Or there might be a way to do this in C#, which I am
not aware of... (also, as you noticed, my VB approach is only for
debugging purposes, as Resume will never executed when running the
code real time as Err.Raise exits the function anyways...)
Any help is greatly appreciated.
Tigger
a way to, when you catch an exception in the catch{} handler, resume
to the same line of code that generated an error while you are
debugging within IDE...? Here is an example from VB:
Private SomeFunction ()
On Error GoTo ErrHandler:
MyMethod this, that
Exit Function
ErrHandler:
Err.Raise smth, smth, smth
Exit Function ' this is for safe-keeping, although not necessary
since
' Err.Raise exits the function anyways
Resume
End Function
In VB world, I would set a breakpoint on Err.Raise line, the execution
will stop when error happens on that line, then I would -manually-
drag a cursor to Resume, and then Step Into would bring me to the
exact line that cause the error in the function. This was very handy
and effective as I could immediatelly tell which call caused the error
and with next Step Into, what was the error while debugging. I can't
find a similar way in catch{} statement. You can view the message,
get Source and StackTrace, and all the other stuff from the various
Exception objects, but you have to read all those properties to see
where exactly the error occurred - which is so much slower than the
way I described. Or there might be a way to do this in C#, which I am
not aware of... (also, as you noticed, my VB approach is only for
debugging purposes, as Resume will never executed when running the
code real time as Err.Raise exits the function anyways...)
Any help is greatly appreciated.
Tigger