Timer job suddnely started failing with below error
Site Enumeration Stack: at Microsoft.SharePoint.Administration.SPSiteCollection.get_Item(Int32 index) at OTIS.AR.EmailTimerJob.EmailTimerJob.Execute(Guid targetInstanceId)
Earlier it was working correctly
SPWebApplication webApp = this.Parent as SPWebApplication;
using (SPSite oSite = new SPSite(webApp.Sites[0].Url))
{
using (SPWeb oWeb = oSite.RootWeb)
{}}
Above is the code used to access SPweb object.
Update 1:
my suspect is error is in below line
List<SPListItem> lstCollStatementItems = new List<SPListItem>();
foreach (SPListItem itm in CollStatementItems)
{
lstCollStatementItems.Add(itm);
}
stack trace : System.Runtime.InteropServices.COMException: Cannot complete this action. Please try again., StackTrace:
at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()
at Microsoft.SharePoint.SPListItemCollection.get_Count()