Wrong line number on stack trace
Posted
by Claudio Redi
on Stack Overflow
See other posts from Stack Overflow
or by Claudio Redi
Published on 2010-03-22T16:07:18Z
Indexed on
2010/03/22
16:11 UTC
Read the original article
Hit count: 522
Hi! I have this code
try
{
//AN EXCEPTION IS GENERATED HERE!!!
}
catch
{
SqlService.RollbackTransaction();
throw;
}
Code above is called in this code
try
{
//HERE IS CALLED THE METHOD THAT CONTAINS THE CODE ABOVE
}
catch (Exception ex)
{
HandleException(ex);
}
The exception passed as parameter to the method "HandleException" contains the line number of the "throw" line in the stack trace instead of the real line where the exception was generated. Anyone knows why this could be happening?
© Stack Overflow or respective owner