I've been trying to find a scenario as to why, adding web parts in my SharePoint environment is causing the dreaded: "Attempted to use an object that has ceased to exist." exception.

All was working fine until Monday. I assumed that it must've been bad coding practice so ran the SPDispose on each build and nothing, everything is disposed of where needed and correct usage of SPContext.Current.Site is used through all my web parts.

I reinstalled SharePoint on my environment and issue persists. Even adding standard SharePoint web parts causes this error.

I know Microsoft released a bug recently that affects some areas of SharePoint, removed the hotfix but to no avail.

Might this be yet another blundered hot fix from Microsoft that's causing this?


Environment this is happening on:

  • Windows 2008 R2 Standard
  • SQL Server 2008 R2
  • SharePoint 2010 Enterprise + SP 2
  • Already tried to add an OOB web part to a new page that doesn't contain any other web part?
    – SPArcheon
    Aug 7, 2013 at 7:37
  • 1
    Tried, still the same problem. I re-installed my environment thinking it's an update issue, worked fine with my code. Updated to SP2 and bam. I don't think it is SP2, rather a fix introduced by SP 2 that is causing my code to break (regulated checks for disposals perhaps?).
    – JadedEric
    Aug 7, 2013 at 7:39
  • 1
    Urgh.. Unless some other issue slipped unseen in your test, I am starting to think you may be right. Sp2 still is very recent, so I wouldn't be so surprised it contains such pretty "present" for devs. Sorry I cannot help more, have my +1.
    – SPArcheon
    Aug 7, 2013 at 7:51
  • Thanks @SPArchaeologist I just reinstalled and the environment and refrained from upgrading to SP2. No issues as of yet.
    – JadedEric
    Aug 15, 2013 at 15:49

1 Answer 1


It sounds like its an object being disposed of too soon. Are you disposing by implementing IDisposable.Dispose()?

One approach that take is Put some trace statements into your code using System.Diagnostics.Trace

You can watch the output of these statements using debug view: http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

You can then hopefully find the offending code section.

  • thank you Simon, i did think of this, but the standard SharePoint components are causing the same exception. Is M$ themselves disposing of objects too soon? web parts tested on an environment not running SP2 is causing no such issue. i have not tried it on another environment with SP2 as I don't have one.
    – JadedEric
    Aug 7, 2013 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.