Kirk Evans Blog

.NET From a Markup Perspective

SPDisposeCheck Released for SharePoint Developers

Awesome job, Paul and co., for finally getting this out to the masses!

For those who are starting to develop with SharePoint, there are types in the API that implement IDisposable.  It is recommended that you ensure that the types are disposed of properly, typically in a using statement.  There is now a tool, SPDisposeCheck, along with guidance, that will help you understand this from a developer’s point of view and provide a tool to help detect areas where potential problems may occur.

The tool and article are both publicly announced here.

The two significant benefit of this project for customers are first that we have updated approved formal guidance for SharePoint Developers using SharePoint IDisposable objects and second we have a tool that will help them to follow this guidance. This is expected to reduce the instances of custom code causing production server crashes.

MSDN Article – Best Practices: Using Disposable Windows SharePoint Services Objects

SPDisposeCheck Tool

The tool evaluates compiled customer code in .NET Assemblies that uses SharePoint in a similar way to FXCop and it reports violations of our guidance for disposing of memory in SharePoint. It is aimed at helping SharePoint Developers to adhere to the best practice guidance. It’s a broad brush sweep of issues but it may not catch all issues and it may point out issues where there is no problem. We recommend it only be used by developers, that people seek advice for troubleshooting memory management issues, that customers with critical issues contact Microsoft support and that the tool should not be installed on production SharePoint servers.