detect a line which cause an exception

  • Thread starter Thread starter andrej
  • Start date Start date
A

andrej

hi,

i have a nt-service. which throws sometimes an exception.
the exception is caught in a catch block. is it possible
to print out a line which cause the exception?

thanks
 
Hi,

Yes, it is possible provided that the service assembly is compiled in the
Debug configuration (or at least has debug info compiled in and its program
database file (.pdb) is available in the same folder). Use the exception's
StackTrace property to retrieve the information about the stack trace state
which includes line numbers when the debug info is available.
 
Back
Top