Exception line error

  • Thread starter Thread starter Adam
  • Start date Start date
A

Adam

I apologize if this is an easy question, but I can't find
a way to do this.

I want the line number of where an error occurred to be
shown in a new exception's message when I use a try/catch
statement. Is there a way to get the line number where
error occurred when catching an Exception?

Example:
try
{
##code##
}
catch(Exception ex)
{throw new Exception(ex.Message + ##error line number##);}
 
Adam,

There is not. The only way that this information will be given is if
the assembly has the debug symbols in it. If you want it otherwise, you
will have to insert the line numbers into your code.

Hope this helps.
 
Back
Top