I am using the timer as below.
Notice I am not using m_Timer.Stop and Start instead of m_Timer.Enabled.

               protected void Initialize()
               {
                       m_Timer.Elapsed += new ElapsedEventHandler(OnTimer);
                       m_Timer.Interval = 200; //check only once every 100 msec;
                       m_Timer.AutoReset = false;
               }

               void OnTimer(Object source, ElapsedEventArgs eargs)
               {
                       // stop and restart the timer if still running
                       m_Timer.Stop();
                       ......
                       m_Timer.Start();
               }

-----Original Message-----
From: Samer Ibrahim [mailto:[EMAIL PROTECTED]
Sent: Monday, June 23, 2003 1:42 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET-CLR] System.Timers.Timer not firing in a windows
service


On Mon, 23 Jun 2003 21:27:06 +0100, Duncan Godwin <[EMAIL PROTECTED]> wrote:

Sorry, I didn't fully read everything the time before

No problem... I appreciate your reply and it was an easily overlooked issue.


do you know how long it is until the timer
stops firing events?  I've had a windows service running for months and I
didn't have any problems
with Server Timers which was also under .NET 1.0.

I don't really know quite honestly... I haven't put anything on there to monitor the amount of time before it just stops firing. It seems to be random though.

Do you have any log of anything else that might be going on?

The log shows nothing. There seem to be no errors occurring and all the actual work is happening within a try..catch..finally statement which reenables the timer in the finally. I've tried setting break points throughout the service once the timer stops firing and I can't get anything to break.

Does it happen on a seemingly regular
interval (e.g. 8 hours no more events) or more randomly?

I'm going to go with randomly for now because it seems to be that way... I'll try to put some logging in to figure out the actual times but that will need several runs and potentially a couple of days if it is in fact several hours before it stops firing.

Thanks again,
Sam

Samer Ibrahim
http://weblogs.asp.net/SIbrahim/




This message was scanned for viruses.


_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail

Reply via email to