SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is your experience with the Code Analysis Framework? Wrong error messages, overlook errors messages etc.

Error List:

  1. SPDispose Check and the SPSiteRootWeb - Wrong SPDispose Error Dispose SPSiteRootWeb
share|improve this question

It might be helpful to be a little more specific in your question. It's definitely possible to get false positives in MSOCAF, and if you can provide a good explanation for it you should be able to submit the explanation as part of the documentation with your change request.

In this case, the rule you referred to is (I believe) generally triggered by explicitly disposing of SPSite.RootWeb object, instead of just disposing the SPSite itself. The RootWeb will be cleaned up automatically, and in fact manually disposing it can cause issues. Generally, just dispose of the SPSite as long as it's one that you're actually supposed to dispose (i.e. not just hanging off a context object). The links in the article you referenced have much more detail on these topics.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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