SPC110246: Do not dispose SPSite returned by SPContext.Current.Site

SPContext objects are managed by the SharePoint framework and should not be explicitly disposed in your code. This is true also for the SPSite objects returned by SPContext.Site and SPContext.Current.Site

TypeName: DoNotDisposeSPSiteCreatedBySPContext
CheckId: SPC110246
Severity: CriticalWarning
Type: AssemblyFileReference
Resolution

Do not dispose SPSite retrieved by SPContext.Site or SPContext.Current.Site

Remarks

Rule relates to SPDisposeCheckId 'SPDisposeCheckID_220'. To ignore this rule add the attribute '[SPDisposeCheckIgnore(SPDisposeCheckID.SPDisposeCheckID_220, "Caller will dispose")]' to your method.

Links

comments powered by Disqus