I have a Windows service written in C# which is meant to perform a task every few minutes. I\'m using a System.Timers.Timer
for this but it doesn\'t ever appea
Apparently, System.Timers.Timer hides any exceptions, swallows them quietly, and then chokes. Of course, you can handle these in your method that you've added as a handler to your timer, but if the exception is thrown immediately on entrance (before the first line of code is executed, which can happen if your method declares a variable that uses an object in a strong-named DLL of which you have the wrong version, for instance), you are never going to see that exception.
And you are going to join us all in tearing your hair out.
Or you could do this:
(I did end up stopping the timer, because if it fails, trying again makes no sense for this particular application...)
Hope this helps those who landed here from Google (as did I).