SPC110213: Dispose SPWeb created by SPWebCollection.Add |
SPC110213: Dispose SPWeb created by SPWebCollection.Add |
The SPSite.AllWebs.Add method and SPWebCollection.Add method creates and returns an SPWeb object. You should dispose of any SPWeb object returned.
TypeName: | DisposeSPWebCreatedBySPWebCollectionAdd |
CheckId: | SPC110213 |
Severity: | CriticalWarning |
Type: | AssemblyFileReference |
The SPSite.AllWebs.Add and SPWebCollection.Add method creates and returns an SPWeb object. You should dispose of any SPWeb object returned from SPSite.AllWebs.Add. See sample from MSDN:
Bad Coding Practice
Rule relates to SPDisposeCheckId 'SPDisposeCheckID_200'. To ignore this rule add the attribute '[SPDisposeCheckIgnore(SPDisposeCheckID.SPDisposeCheckID_200, "Caller will dispose")]' to your method.
Copyright © 2013 RENCORE AB. All Rights Reserved
Disclaimer: The views and opinions expressed in this documentation and in SPCAF are those of the creators and do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. All trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners. SharePoint Code Analysis Framework, Version 4.5.2.7855, see www.spcaf.com for more information |