I have a COM add-in for Office apps that performs an operation in the background every 30 minutes using a
System.Timers.Timer
This background operation performs user authentication over an Internet connection, and I have reports from some users that authentication fails when their PCs wake from sleep. I cannot reproduce this behavior myself, so my theory is that when the PC wakes, the background operation executes before a connection to the Internet is restored (presumably, the connection was closed by Windows when the PC went to sleep).
In general, if a PC goes to sleep after a period of inactivity, what happens when the PC wakes (in terms of Timers
)? For example, is the Timer
paused while sleeping, and then resumes at its set interval when the PC wakes (e.g if the Timer
was 10 min into the interval when the PC went to sleep, the Timer.Elapsed
event won't fire until 20 min after the PC wakes)? Is the Timer.Elapsed
event queued so that it fires immediately upon the PC waking? Does Windows stop the Timer
when the PC goes to sleep? Or, does the Timer
keep running while the PC sleeps, but since the Internet connection is broken (presumably), the background operation cannot perform user authentication?