I have an event receiver (ItemAdded and ItemUpdated) that seems to be doing the right things when I am debugging the code. However after deploying, I don't seem to be getting any reaction when an item is either added or updated to the list. Here is what my snippet looks like...
public override void ItemUpdated(SPItemEventProperties properties)
{
//base.ItemUpdated(properties);
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(properties.SiteId))
{
using (SPWeb currentWeb = site.OpenWeb(properties.Web.ID))
{
EventFiringEnabled = false;
SPListItem item = properties.ListItem;
//Perform required tasks
}
}
});
}
catch (Exception ex)
{
SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("Sample Event Receiver", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace);
}
finally
{
this.EventFiringEnabled = true;
}
}I have updated my Elements.xml to indicate the list that the receiver is wired to. When I step through my code, the receiver gets fired (like it is supposed to) when an item on the list is modified and it steps through the code. It then gets through the "finally" blocks and seems to step out and just hang without ending, so I have to manually stop the debugger. Even though it does this, it still performs the tasks that it needs to.
Using PowerShell, I have Added and Installed the Solution...but when I go to change an item in the list (on the site), I do not see anything happening to indicate that the code actually ran. Is there something wrong with the way I am going about my code and deployment? Thanks for the help and ideas.