Thursday, January 13, 2011

Making use of the SPDisposeCheck utility

Most seasoned SharePoint developers have found out one way or another that you have to be mindful of properly disposing your SharePoint objects. Unfortunately, the rules, guidelines and general practices are often confusing and un-intuitive. Because of this it is common to find SPSite, and SPWeb objects that are not properly disposed. To help combat this issue Microsoft has released a tool called the SPDisposeCheck utility that will analyze your assemblies and report on any improperly disposed Shared Point objects.

The utility can be downloaded here:

To integrate the utility into your development environment, in Visual Studio go to the "Tools" menu and select the "External Tools" menu item. Select "Add" and configure the tools options as follows:

External Tools Window