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.

Comments (26)

  1. SPDisposeCheck – This should be in EVERY SharePoint developer’s toolbox

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

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

  4. Roger Wilson says:

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

  5. 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.

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

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

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

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

  10. Senthil says:

    Must tool for All SharePoint Developers!

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

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

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

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

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

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

  17. area man says:

    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)

  18. pandrew says:

    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

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

  20. 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

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

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

  23. Scoutman says:

    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

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