Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

How to tell if SPWeb.Dispose() actually works?

$
0
0

I am getting a timeout error when I activate a Web Application feature that applies a master page across xx Site Collections.

ULS Viewer shows that my SPRequests are not being properly disposed of.

So I've attempted to debug my code and have found every time SPWeb.Dispose() is called, nothing actually happens.  I delayed and looped; trying to see if maybe its not very quick on the uptake.  No matter how long I wait, my SPWeb object is never changed to null, none of the variables are ever changed, and no exceptions are thrown.

So how do I know that Dispose() is doing what it needs to do so that I don't get timeout errors?

using (SPSite Site = properties.Feature.Parent as SPSite) { SPWebCollection Webs = Site.AllWebs; foreach (SPWeb Web in Site.AllWebs) { try {

} catch (Exception) { } Web.Dispose(); } }




Viewing all articles
Browse latest Browse all 25064

Trending Articles