The title of this post is supposed to represent what you might search for if you experience the same issue I just have. I understand that it’s hard to understand what this post is all about just from this title, but it’s really the best title I could come up with. Feel free to comment if you’ve got something better.
I just spent the better part of 3 hours testing some additions I put in place on top of a Timer Job project that I had deployed a few weeks ago. Basically I wanted to read a SharePoint web application’s web.config file from inside the Timer Job. I found that even though my code looked correct and should have been working, that it was not. Of course, my next step was to attach Visual Studio 2010’s debugger to SharePoint Timer Service process, OWSTIMER.exe.
Well, while stepping over my lines of code, I found that the debugger was not going in order. In other words, if the breakpoint/debugger/yellow highlight is currently at the code on Line 23 (just making it up), when I hit F10 I expected the breakpoint/debugger/yellow highlight to move to Line 24. However, this was not always the case. I found that while some lines of code would run in order, others might not.
I tried an IISReset, but that was to no avail. What ended up working was restarting the Timer service. I opened up the Services console on my server, found the SharePoint 2010 Timer service, right-clicked it and clicked Restart and that did the trick. After restarting this service, I closed out of Visual Studio 2010 and started it up fresh as well just to ensure that it wouldn’t be part of the problem. I attached the debugger and started stepping through my code again and no longer had the problem. Oh, and now my application can successfully read from/write to SharePoint web.config files too, which was kind of the whole point of the last three hours.
Thanks to my wife for making me some nachos to get me out of the office for a few minutes. That’s what ultimately allowed my brain to refresh so that when I came back to it, it was only a matter of moments until I had resolved my issue.