Wesley Bakker

Interesting things I encounter doing my job...

Sponsors

News

Wesley Bakker
motion10
Rivium Quadrant 151
2909 LC Capelle aan den IJssel
Region of Rotterdam
The Netherlands
Phone: +31 10 2351035

(feel free to chat with me)
 

Add to Technorati Favorites

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

Comments

SPItemEventReceiver Bug said:

Pingback from  SPItemEventReceiver Bug

# June 15, 2011 9:20 AM

AndrewSeven said:

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.

# June 15, 2011 10:02 AM

webbes said:

@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...

# June 20, 2011 5:03 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)