{"id":984,"date":"2011-01-21T12:31:10","date_gmt":"2011-01-21T11:31:10","guid":{"rendered":"http:\/\/www.itidea.nl\/?p=984"},"modified":"2015-09-08T20:33:46","modified_gmt":"2015-09-08T18:33:46","slug":"spdisposecheck-how-to-suppress-a-false-positive","status":"publish","type":"post","link":"https:\/\/www.itidea.nl\/index.php\/spdisposecheck-how-to-suppress-a-false-positive\/","title":{"rendered":"SPDisposeCheck How to suppress a false positive"},"content":{"rendered":"<p>Recently I asked a question on Twitter on how to suppress a false positive with the SPDispose check tool and\u00a0Wictor Wil\u00e9n pointed me to the right direction.<br \/>\nSeveral times I&#8217;m asked about the solution\u00a0so I&#8217;m sharing\u00a0it with you now.\u00a0<\/p>\n<p>First of all you have to download the SPDisposeCheck tool and the SPDisposeCheckRules for Visual Studio 2010.<br \/>\nSPDisposeCheck tool: <a href=\"http:\/\/download.microsoft.com\/download\/B\/4\/D\/B4D279A0-E159-40BF-A5E8-F49ABDBE95C7\/SPDisposeCheck.msi\">http:\/\/download.microsoft.com\/download\/B\/4\/D\/B4D279A0-E159-40BF-A5E8-F49ABDBE95C7\/SPDisposeCheck.msi<\/a><br \/>\nSPDisposeCheckRules for Visual Studio 2010: <a href=\"http:\/\/spdisposecheckstatic.codeplex.com\/releases\">http:\/\/spdisposecheckstatic.codeplex.com\/releases<\/a>\u00a0<\/p>\n<p>After downloading install the SPDisposeCheck tool on your machine and extract the zip file for the rules. The zip file contains a readme-vs2010.txt with instructions. Follow these instructions.\u00a0<\/p>\n<p>The SPDisposeCheck tool is installed on the following location:<br \/>\nC:\\Program Files (x86)\\Microsoft\\SharePoint Dispose Check\u00a0<\/p>\n<p>At this location a zip file called SPDisposeExamplesSource.zip can be found. In this zip file several classes are stored, one of them is the class SPDisposeCheckIgnoreAttribute.cs.<\/p>\n<p>To suppress a false positive you have to include this class in your project.<\/p>\n<p>After including the attribute to suppress a false positive can be used:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n&#x5B;SPDisposeCheckIgnoreAttribute(SPDisposeCheckID.SPDisposeCheckID_110, &quot;Don't want to do it&quot;)]\r\npublic void CreatingSPSiteLeak()\r\n{\r\n\u00a0\u00a0\u00a0 SPSite siteCollection = new SPSite(&quot;http:\/\/moss&quot;);\r\n\u00a0\u00a0\u00a0 \/\/ siteCollection leaked\r\n}\r\n<\/pre>\n<p>The above example is an example from another class in the zip file: SPSiteLeak.cs<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I asked a question on Twitter on how to suppress a false positive with the SPDispose check tool and\u00a0Wictor Wil\u00e9n pointed me to the right direction. Several times I&#8217;m asked about the solution\u00a0so I&#8217;m sharing\u00a0it with you now.\u00a0 First &#8230; <a class=\"more-link\" href=\"https:\/\/www.itidea.nl\/index.php\/spdisposecheck-how-to-suppress-a-false-positive\/\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[20,42,6],"class_list":["post-984","post","type-post","status-publish","format-standard","hentry","category-sharepoint-2010","tag-c","tag-sharepoint-2010","tag-visual-studio"],"_links":{"self":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/984","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/comments?post=984"}],"version-history":[{"count":7,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/984\/revisions"}],"predecessor-version":[{"id":990,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/984\/revisions\/990"}],"wp:attachment":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/media?parent=984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/categories?post=984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/tags?post=984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}