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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top