SPItemEventReceiver Bug

Normally when you inherit a class, and override any of the methods, you call the base method, just to be sure you do not interfere with the inner workings of the class. There is a bug however in the SPItemEventReceiver class that always changes the Status to Continue, even if I decided it should stop and cancel. TMHI this is simply a bug. Especially since the SPEventReceiverStatus.Continue enum value is 0 and thus the default value.

SPItemEventReceiver

 

Conclusion

If you decide to Cancel the action do not call the base implementation.

SPItemEventReceiver2

 

Cheers,

Wes

2 Comments

  • When and if we should call the base method in an overload is always a bit nebulous.

    In event receivers, I always call the base method as the first line in the method.

  • @AndrewSeven: You are totally right. In this case however they should have built this thing for extensability. I see no reason at all to revert any changed status to the default value again. But again, that is my humble opinion...

Add a Comment

As it will appear on the website

Not displayed

Your website