Article ID: 842793 - Last Review: May 18, 2007 - Revision: 1.7 BUG: The Elapsed event of the System.Timers.Timer class is not raised in a Windows serviceOn This PageSYMPTOMSYou can use the Microsoft .NET Framework to create a new Microsoft Windows
service that contains a System.Timers.Timer object. When you run this new Windows
service, the Elapsed event of the System.Timers.Timer class
may not be raised. CAUSENote In this section, the System.Timers.Timer object is referred to as the Timer object. In the event handler for the Elapsed event of the Timer object, if you call the Stop method of the Timer object, the reference to the Timer object is lost. The garbage collector then reclaims the memory that is associated with the Timer object. Later, even if you call the Start method of the Timer object to raise the Elapsed event, the call does not work. The Elapsed event is not raised. WORKAROUNDTo work around this problem, obtain the hotfix in the following Microsoft Knowledge Base article: 900822
(http://support.microsoft.com/kb/900822/
)
FIX: When a .NET Framework based application uses the System.Threading.Timer class, the timer event may not be signaled in the .NET Framework 1.1 S900822
Additionally, use a System.Threading.Timer object instead of the
System.Timers.Timer object.STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed in the "Applies to"
section. MORE INFORMATIONSteps to reproduce the behavior
REFERENCESFor additional information, visit the following Microsoft
Developer Network (MSDN) Web sites: Forcing a garbage collection http://msdn2.microsoft.com/en-us/library/s5zscb2d(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/s5zscb2d(vs.71).aspx) Introduction to server-based timers http://msdn2.microsoft.com/en-us/library/tb9yt5e6(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/tb9yt5e6(vs.71).aspx) Timer class http://msdn2.microsoft.com/en-us/library/system.timers.timer(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/system.timers.timer(vs.71).aspx) Windows Service applications http://msdn2.microsoft.com/en-us/library/aa984074(VS.71).aspx (http://msdn2.microsoft.com/en-us/library/aa984074(VS.71).aspx)
| Article Translations
|
Back to the top
