In my Sitecore application I have the below statements.
using (new Sitecore.SecurityModel.SecurityDisabler())
{
Item item = database.GetItem(itemId);
if (item != null)
{
item.Delete();
}
}
The item
object is not null and in item.Delete();
statement the error occurs.
Can anyone tell whats wrong with this issue?
Updated: Stack trace
at Sitecore.Tasks.ItemEventHandler.OnItemDeleted(Object sender, EventArgs args)
at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result)
at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters)
at Sitecore.Events.Event.RaiseEvent(String eventName, Object[] parameters)
at Sitecore.Events.Event.RaiseItemDeleted(Object sender, ItemDeletedEventArgs args)
at Sitecore.Events.Event.DataEngine_ItemDeleted(Object sender, ExecutedEventArgs`1 e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at Sitecore.Data.Engines.EngineCommand`2.RaiseExecuted()
at Sitecore.Data.Engines.EngineCommand`2.Executed()
at Sitecore.Data.Engines.EngineCommand`2.Execute()
at Sitecore.Data.Engines.DataEngine.DeleteItem(Item item)
at Sitecore.Data.Managers.ItemProvider.DeleteItem(Item item, SecurityCheck securityCheck)
at Sitecore.Data.Managers.ItemManager.DeleteItem(Item item)
at Sitecore.Data.Items.Item.Delete(Boolean removeBlobs)
at Sitecore.Data.Items.Item.Delete()
I have further found that the item is actually got deleted from the Sitecore tree, and then gave the error.