Wednesday, November 20, 2013

How to: Debug a timer job deployment?

Intro:
So I've been tasked with writing a Custom SharePoint timer job.
So I googled it up and I followed Andrew Connell's article
http://www.andrewconnell.com/Creating-Custom-SharePoint-Timer-Jobs

Symptoms:
After I made modifications to suit my needs I go and try to deploy it (by pressing F5). After which I get a very descriptive message:
Error occurred in deployment step 'Activate Features': Object reference not set to an instance of an object.
So I comment out every line of the "Activate Features" code and try to diagnose it. Breakpoints don't seem to work.

Workaround/Resolution:
Insert
System.Diagnostics.Debugger.Launch();
into your code and if all goes right Visual Studio will pick up the task of debugging your code.

No comments:

Post a Comment