That wasn’t too descriptive was it? Not sure if this has been documented anywhere else but I came across a quirk today while I was trying to create custom Event Handlers for a Document Library.
Environment:
Windows 2003
MOSS 2007
Visual Studio 2008
Visual Studio SharePoint Extension Kit 1.2
Scenario:
Using the EventReceiver SharePoint template in Visual Studio, I started out with the ItemUpdating method and deployed some code a few times and then decided to switch to using the ItemUpdated method instead. For a dozen builds or so after that I couldn’t figure out whether or not my code was working or the ItemUpdated event was even firing. When I switched back to the ItemUpdating method, it worked as expected even with new code. Switched back to ItemUpdated and no good, no events fired even after IIS resets.
Solution:
Finally I decided to remove the event handler manually by doing the following:
– deactivated the feature
– retracted the solution
– deleted the solution
– deleted the dll in the GAC
-IISReset
Then after rebuilding/redploying the solution everything worked just as expected. Woohoo!
I have had this problem in the past also. Sometimes clearing the whole thing out helps. I’ve actually found sometimes the error still persists.
With Event Receivers, I’ve also found SharePoint Inspector helpful as you can see visually whether the Event Receiver is actually attached to the list and for what type of event e.g. updated or updating. You can also actually remove them off the list here too!
I also tend to clean up after myself with Features too, so that when you deactive the feature it removes the event receiver from the list – that’s if you are attaching it using the elements manifest way or in api on activating.
Awesome tips, thanks Jeremy!
Thanks for sharing your scenario. I always use step 1-3 (of your solution) for custom event handlers and that works for me.
We’ve had pretty much the same problem, however I only needed to deactivate the event receiver at the site level (where the list is), activate it again and do IISReset for it to work again ๐
This drove me nuts for 3 days! Thanks for the post.