Welcome to MSDN Blogs Sign in | Join | Help

Paul Andrew

Microsoft Technical Product Manager for the SharePoint Developer Platform
SPDisposeCheck v1.3.1 is released

SPDisposeCheck is a tool to help SharePoint Developers follow memory management best practices when using the SharePoint API with IDisposable objects including SPSite and SPWeb. This tool is not supported by Microsoft and is recommended to be used on Developer workstations and not on production SharePoint Server installations.

It was released yesterday at http://code.msdn.microsoft.com/SPDisposeCheck

The tool reviews a .NET Assembly (DLL or EXE) and evaluates SharePoint API's used in that assembly. It will produce a report identifying where code doesn't follow best practices for memory management in SharePoint. It may not find all memory leaks in your code and it may produce false positive results but it does it much faster than you can review source code yourself. The tool checks for guidance published in an update to the MSDN Article (Best Practices: Using Disposable Windows SharePoint Services Objects) that describes the best practices for this area of SharePoint development. This guidance applies only to customers building custom software that they compiled to .NET assemblies that make use of SharePoint API calls. While these messages need expert evaluation in order to determine if the software is not performing properly, in some cases just running the tool on your custom code can lead you to simple fixes that improve the quality and performance of custom code on SharePoint. Customers who are currently experiencing difficulties with memory management in their custom applications should review the guidance listed above. Customers who are currently experiencing difficulties with Microsoft Office SharePoint Server 2007 should contact their regular Microsoft Customer Support Services contact, or refer to http://support.microsoft.com.

note: The MSDN article hasn't been updated at the time of the blog postThe MSDN article should be updated in the next 24 hours. 

You are encouraged to discuss usage of this tool on the SharePoint Developer MSDN Forum. You can also provide feedback directly on the CODE.MSDN site for SPDisposeCheck where we published it. We value your feedback on how useful this tool is.

We plan to use Roger Lamb's blog as a place to update the latest guidance for specific cases that come up.

Posted: Thursday, January 29, 2009 9:18 AM by pandrew
Filed under:

Comments

Andrew Connell [MVP MOSS] said:

SPDisposeCheck - This should be in EVERY SharePoint developer's toolbox

# January 29, 2009 1:40 PM

Mirrored Blogs said:

[via Paul Andrew ] Today Microsoft released a tool on MSDN Code Gallery called SPDisposeCheck . It will

# January 29, 2009 2:14 PM

SharePoint MVP Blogs said:

Paul Andrew has just announced that the SharePoint Disposable Object checking tool SPDisposeCheck has

# January 29, 2009 2:44 PM

Roger Wilson said:

[via Paul Andrew] Today Microsoft released a tool on MSDN Code Gallery called SPDisposeCheck. It will...

# January 29, 2009 3:00 PM

Tony Bierman [MVP WSS] said:

I think there should be a "SPDisposeCheck Certified" logo.  This badge could be placed on the download pages and in the documentation of both free software and commercial software products as an indication of quality and adherence to best practices.

# January 29, 2009 3:08 PM

Microsoft SharePoint Team Blog said:

SPDisposeCheck v1.3.1 has been released on MSDN Code Gallery, http://code.msdn.microsoft.com/SPDisposeCheck

# January 29, 2009 4:23 PM

Aaron Robertson-Hodders SharePoint Blog said:

By now you have probably heard that the SharePoint Dispose Checker has been released. It's an excellent

# January 29, 2009 5:22 PM

Blog del CIIN said:

Tal y como nos comenta Paul Andrew en este post , Microsoft acaba de liberar en MSDN Code Gallery la

# January 29, 2009 5:23 PM

Roger Lamb's SharePoint Developer Blog said:

Today the Microsoft SharePoint Product Team announced the SPDisposeCheck utility here and also at Paul

# January 29, 2009 9:24 PM

Senthil said:

Must tool for All SharePoint Developers!

# January 30, 2009 12:38 AM

Jan Tielens' Bloggings said:

[ Via Paul Andrew ] Now here is a must have tool for every SharePoint developer that wants to make sure

# January 30, 2009 1:40 AM

Philippe Sentenac [MVP SharePoint] said:

[via Paul Andrew ] SPDisposeCheck avait été présenté dernièrement sur le blog de l'équipe SharePoint

# January 30, 2009 3:41 AM

.neting in the free world said:

Nareszcie! Po 2 miesiącach od zapowiedzi , MS opublikował narzędzie do sprawdzania czy nasz kod SharePoint

# January 30, 2009 7:14 AM

Dario Martirani Paolillo's Web Log said:

A must-have for each Sharepoint developer. More info are available at Paul Andrew’s blog: http://blogs.msdn.com/pandrew/archive/2009/01/29/spdisposecheck-v1-3-1-is-released.asp

# January 30, 2009 12:17 PM

Microsoft SharePoint Bloggers said:

SPDisposeCheck is a tool to help SharePoint Developers follow memory management best practices when using

# January 30, 2009 1:48 PM

Kirk Evans Blog said:

Awesome job, Paul and co., for finally getting this out to the masses! For those who are starting to

# January 30, 2009 10:05 PM

Sowmyan's SharePoint Developer Blog said:

Microsoft has released 3 cool things for SharePoint develoepers recently. 1. SPDisposeCheck v1.3.1 2.

# January 31, 2009 11:16 PM

area man said:

I tried to run the tool and following error is thrown

--------------------

Unhandled Exception: System.InvalidOperationException: Disposition.Problem is in

accessible due to its protection level. Only public types can be processed.

  at System.Xml.Serialization.TypeDesc.CheckSupported()

  at System.Xml.Serialization.TypeDesc.CheckSupported()

  at System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo sourc

e, Boolean directReference, Boolean throwOnError)

  at System.Xml.Serialization.ModelScope.GetTypeModel(Type type, Boolean direct

Reference)

  at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type

, XmlRootAttribute root, String defaultNamespace)

  at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultName

space)

  at System.Xml.Serialization.XmlSerializer..ctor(Type type)

  at SPDisposeCheck.SPDisposeCheck.Main(String[] args)

# February 2, 2009 12:22 PM

pandrew said:

To work around the System.InvalidOperationException please avoid using the -xml command line switch. This command line switch is failing in this way for many customers right now. We plan to resolve this in a future release.

Regards,

Paul

# February 2, 2009 1:46 PM

Ron Grzywacz's Blog said:

For those of you looking to double check your custom SharePoint code for proper object disposal, Microsoft

# February 3, 2009 9:34 AM

Johan Skårman said:

I found it interesting that SPDisposeCheck ignored files and namespaces that started with Microsoft and System. With a little bit of reflection I managed to come around the “problem”:

Microsoft.SharePoint.dll 9

Microsoft.Office.Policy.dll 1

Microsoft.Office.Server.Search.dll 1

microsoft.sharepoint.portal.dll 2

Microsoft.SharePoint.Publishing.dll 10

Microsoft.SharePoint.Search.dll 1

# February 4, 2009 3:02 AM

Luis Du Solier G. - SharePoint en Español said:

SharePoint Diagnostics (SPDiag) Tool v1.0 for SharePoint Products and Technologies The real power of

# February 12, 2009 12:19 AM

.neting in the free world said:

Nareszcie! Po 2 miesiącach od zapowiedzi , MS opublikował narzędzie do sprawdzania czy nasz kod SharePoint

# February 16, 2009 5:13 AM

Scoutman said:

Hi there, ive just develop a wrapper to use with SPDisposeCheck Tool, that

displays Xml with errors if so, and its to be used on VisualStudio postbuild

events to prevent bad disposal of Moss objects.

I hope it helps someone in a need.

http://www.codeplex.com/MossSnips2

Best Regards

Scoutman, a portuguese connection

Rodrigo Pinto, Sharepoint Solution Architect

email:stationsolutions@gmail.com

im:workstationpt@hotmail.com

# February 16, 2009 7:26 PM

SharePoint en Español - Luis Du Solier G. said:

SharePoint Diagnostics (SPDiag) Tool v1.0 for SharePoint Products and Technologies The real power of

# April 7, 2009 3:30 AM
New Comments to this post are disabled
Page view tracker