I have a Console Application with the following main program:
static void Main(string[] args)
{
var timer = new System.Threading.Timer(
e =>
{
//some code here
},
null,
TimeSpan.Zero,
TimeSpan.FromMinutes(1));
var backupTimer = new System.Threading.Timer(
e =>
{
//some code here
},
null,
TimeSpan.Zero,
TimeSpan.FromHours(24));
Console.ReadLine();
}
The problem is that in debug mode it works fine and call methods in both timers in right period and if enter something in console the program ends working (Console.ReadLine() is for that) , but when i'm running program in Release mode both timers called only once (the first time) and then program just waiting until i enter something.
How to fix the problem , so i can compile a standalone program working properly?