Do you remember the SPDisposeCheck Static Analysis RuleSet for Visual Studio 2008/10 ? It was pretty nifty, I’ve used it in many SharePoint 2010 projects and it did a great job. Yesterday, I decided to upgrade it to work with Visual Studio 2012 and I’ve published it today on CodePlex. You can get it from here.
This wonderful RulSset has been originally created by Stephen Vick, I just tweaked it a little bit to make it work with Visual Studio 2012.
What is Visual Studio Static Code Analysis ? http://msdn.microsoft.com/en-us/library/3z0aeatx.aspx
What is SPDisposeCheck ? http://archive.msdn.microsoft.com/SPDisposeCheck
By using SPDisposeCheck from within your Code Analysis, you can avoid any future memory leaks that might occur because your developers didn’t properly dispose the SharePoint API objects. You can even prevent bad code from entering your Source Control system by creating a check-in policy that performs Static Code Analysis and spot any issues earlier.
I have created a video that explains the setup steps and shows you a quick example. You can watch it here.