I have written a custom timer job, created a feature, and written a feature receiver to install and uninstall the Timer Job in the web app on Activate/Deactivate. The custom job roughly follows the examples af Andrew Connell here: http://www.andrewconnell.com/blog/articles/CreatingCustomSharePointTimerJobs.aspx.
The Feature is Site-scoped, and not visible. I am doing all of the feature install/uninstall and activate/deactivate via STSADM.exe.
Deployment is fine, and the feature installs, activates, deactivates, and uninstalls smoothly. The Feature event receiver is working correctly: the custom job definition appears and dissappears from the Central Administration -> Operations -> Timer Job Definitions interface when the feature activates and deactivates.
However, when the job itself is executed by the timer process, I get errors in the ULS logs and the System Event log. From the ULS Logs:
10/12/2010 13:10:00.14 OWSTIMER.EXE (0x1CE8) 0x2DDC Windows SharePoint Services Timer 7psa Critical The Execute method of job definition Example.TimerJobs.RequiredTaskMonitorJob (ID 94f5f3ce-ed38-4e27-b15d-1b00a6a143c1) threw an exception. More information is included below. Value does not fall within the expected range. 10/12/2010 13:10:00.14 OWSTIMER.EXE (0x1CE8) 0x2DDC Windows SharePoint Services Timer 72ae Unexpected Exception stack trace: at Microsoft.SharePoint.SPListCollection.GetListByName(String strListName, Boolean bThrowException) at Microsoft.SharePoint.SPListCollection.get_Item(String strListName) at Example.TimerJobs.RequiredTaskMonitorJob.Execute(Guid contentDbId) at Microsoft.SharePoint.Administration.SPTimerJobInvoke.Invoke(TimerJobExecuteData& data, Int32& result)
Note that this error occurs no matter what the content of the Execute() method is. Originally I was reading in the details of a SPList used for configuration, and creating Task List items when certain conditions were found to be true.
But in the currently-installed version of the Timer Job, the Execute() method is entirely empty. I don't even call the base class's implementation of it. I have no idea where it is trying to call the SPListCollection.get_Item() method; it's certainly not in my code.
Is anyone able to assist with this error?
Thanks for your help,