Fellow WP devs, stop hatin’ the Scheduled Agents in Windows Phone ! xD If you are suffocating from a weird bug for a long time, its prolly not a Framework’s fault, but could be a minor mistake in your code thats is causing the whole mess. It is because Background Scheduled executions on WP is highly restricted and limited, whereas it throws exceptions even for the slightest glitch screwing up the entire thread circle, by interrupting NotifyComplete(); ! O.o
Bottom line, I too hate their stupid restricted Scheduled executions because they are so restricted, but gotta deal with it.. -_- for gods sake, once only 30 minutes !😦 OH COME ONNNNNNN ! :S
Anyhow recently I came across this issue where the Scheduled Agent wasn’t firing in my apps when the app was published to the marketplace and then downloaded to the phone to use. After one or two times of execution the background agents weren’t working, so I later found out it was because of the “LaunchForTest()” method I have called inside the “OnInvoke()” method of the Background Agent. Guys this is a serious issue, most of us try to decrease the time span in a Scheduled Agent execution by using this method every time the “OnInvoke()” method fires. But this is a completely risky because it throws InvalidOperation exception ! :O
Therefore at end user level the Scheduled Agents crashes because the “NotifyComplete()” gets interrupted due to the exception that occurs as above. Because in order to complete and move on to the next thread execution circle the “NotifyComplete()” is crucial.
Check out more about this issue and the solution from below link,
Have fun Coding WP Apps !😉