I can’t find a dedicated post about it, so I thought I’d draw attention to this thread in the MSDN forums where Michael Washam [MSFT] replied…
Do not dispose properties.Feature.Parent..
However, if you use .ParentWeb or anything else the same rules apply..
Now, the rule for SPWeb.ParentWeb
is that it should not be disposed if you don’t own the child SPWeb
, which we don’t, but you get the idea. It would be great if SPDisposeCheck would catch this—Roger?
I only point it out specifically because feature receiver examples are often posted online and I see Parent
disposed all the time.
February 8, 2009 at 4:32 pm
Haha yeah I’ve made the mistake of disposing of objects in a FeatureReceiver before, biiiig mistake
February 8, 2009 at 6:14 pm
[…] Do Not Dispose SPFeatureReceiverProperties.Feature.Parent […]