I recently deployed a custom user control usingĀ SmartPart on SharePoint 2007, and although everything else seemed to work fine, I came across the following error when trying to edit the properties (in my case, the chrome type and width):
Cannot save the property settings for this Web Part. Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))
I managed to resolve this, thanks to an MSDN forum post, by changing one of my lines of code:
using (SPSite oSiteCollection = SPContext.Current.Site)
to the slightly more long-winded:
using (SPSite oSiteCollection = new SPSite(SPContext.Current.Site.ID))
I’m not sure why using SPContext.Current.Site directly (versus creating a new SPSite object) causes this behaviour, but at least it’s a simple fix.