Q: Timer in windows service not trapping exceptions...

J

Jiho Han

I have a windows service that creates and starts a timer. And when the
timer has elapsed, it performs a few things and resets the timer.
(AutoReset = false, so it only executes once).

However, in the handling thread - I am assuming that the elapsed handler is
running on a separate thread from the main one - if an exception occurs, it
seems to be lost. The exception is not propagated up the chain where the
service with AutoLog set to true, should catch it and log it to windows
event log. The exception simply disappears as I confirmed while debugging
in the IDE.

Anyone know why this may be happening?
Also, if using a timer is not the right solution to invoke a set of commands
at certain intervals, what alternatives are there?

Thanks in advance
Jiho
 
J

Jiho Han

BTW, I am using System.Timers.Timer.
I think I am going to try using System.Threading.Timer instead...
 

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

Top