I built a custom Timer Job on activation I was able to debug it and it was going through Execute method I am overriding but suddenly its not overriding anymore.
Code is here:
public class TimerJob : SPJobDefinition
{
private const string TIMERJOB_NAME = "Timer Job";
public TimerJob()
: base()
{
}
public TimerJob(SPWebApplication webApp)
: base(TIMERJOB_NAME, webApp, null, SPJobLockType.ContentDatabase)
{
this.Title = TIMERJOB_NAME;
}
public override void Execute(Guid targetInstanceId)
{
try
{
//System.Diagnostics.Debug.Assert(false);
getPendingItems();
}
catch (Exception ex)
{
AppCode.Logging.LogWepApplicationErrorMessage(ex, TIMERJOB_NAME, this.WebApplication.Name);
}
}
While Debugging it goes through second constructor and ignores Execute method and returns control to Feature Receiver class
Edited
I defined schedule as below, but even after 5 minutes when I check Job properties > Last run time: it says N/A
SPMinuteSchedule schedule = new SPMinuteSchedule();
schedule.BeginSecond = 0;
schedule.EndSecond = 120;
//SPHourlySchedule schedule = new SPHourlySchedule();
//schedule.BeginMinute = 0;
//schedule.EndMinute = 3;
TimerJob.Schedule = schedule;
TimerJob.Update();
simply doesn't work :(
