When making changes to a SharePoint 2010 timer job, deploying (via Visual Studio) and then debugging I was coming across a problem where the code just didn’t work.
I added code into the Execute method to just assign a value to a string:
Code Snippet
- String testString1 = "I would like ";
- string testString2 = "a cheese sandwich ";
- var testString3 = "very much";
However, although the debugger stepped into this code, the string values were null.
To fix this, you need to restart the SharePoint timer service each time you deploy
And you may need to do this twice
I just added the following in Visual Studio to my post deployment command line options:
net stop “SharePoint 2010 Timer”
net start “SharePoint 2010 Timer”
net stop “SharePoint 2010 Timer”
net start “SharePoint 2010 Timer”
