[Solved] Bad timer in Windows service


You have most likely an error somewhere in your timer making it throw an exception. You will not detect that since System.Timers.Timer silently ignores all unhandled exceptions.

You’ll therefore have to wrap all code with a try/catch block:

private void getFileList(object sender, EventArgs e)
{
     try
     {
         DeleteOldBackupFiles();
     }
     catch (Exception ex)
     {
         //log exception or just put a breakpoint here.
     }
}

Hence your timer is working, but you are doing something wrong in it.

solved Bad timer in Windows service