SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have vs 2010, moss 2010, and I'm trying to debug a custom timer job, so I've set breakpoints on the feature receiver, but when I run the project or just right click deploy, my break points are never met.

Here is the code, as you can see its just a standard feature receiver:

public class StructureImportEventReceiver : SPFeatureReceiver
    const string List_JOB_NAME = "StructureImporter";

    public override void FeatureActivated(SPFeatureReceiverProperties properties)
        SPSite site = properties.Feature.Parent as SPSite;
        // Break point is set on line above ... rest of code below

I guess if I could get the debugger to stop on this breakpoint, I could step through to the rest of the timer job, but alas... nothing. What am I doing wrong?

share|improve this question
up vote 1 down vote accepted

There was a well-known technique to debug a custom timer job on MSDN:

The technique should be still valid in SharePoint 2010. Also check out:

share|improve this answer
Instead of System.Diagnostics.Trace.Assert(false), you can use System.Diagnostics.Debugger.Break(). This will directly provides a debug engine choose dialog. – Steve B Jun 8 '12 at 14:44

You need to attach to OWSTIMER process instead of w3wp to debug timer jobs. Don't forget to restart the service after deploying latest code to debug.

share|improve this answer

Here is what I generally use:

  1. From VS2010, I do an F5 to deploy and debug the solution. Also I manually attach the owstimer.exe with executing code. Note: If this does not work, then you should try restarting the SharePoint timer service.

  2. Another ways is to manually put the .pdb file inside the solution assembly folder under GAC (C:\Windows\assembly\gac_msil) and do a IIS reset. Further attach the owstimer.exe with the VS2010 solution and wait for the timer to hit the code.

share|improve this answer

Call System.Diagnostics.Debugger.Launch() to debug your timer job. Place this line of code in your Execute method on the Timer Job itself.

share|improve this answer
While this post may answer the question, we prefer more details such as "why". Please edit your post with additional details. See answer for general guidelines. (Short answers like this get flagged by the system.) Thanks. – SPDoctor Jun 6 '12 at 7:40

For sharepoint 2007 or sharepoint 2010 you can attach OWSTimer.exe. If still it does not work then restart the timerjob service in services.msc

Please visit my article

to know about

   Create Custom timer job
   debug timer job
   deploy timer job
   using WSP and feature deploy timer job
   Use TimerJobdefinition class
   pass & store url timer job property bag
   restarting timer job
share|improve this answer

Follow below steps to debug Timer Job:

  1. Put break point from where you want to start debug.

  2. From Debug menu select >> Attach to process

  3. Select OWSTIMER.exe and click on Attach button.

  4. Deploy project and wait until execution stops at break point.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.