Sys.WebForms.PageRequestManagerServerErrorException: Trying to use an SPWeb object that has been closed or disposed and is no longer valid.
This is the error message that a user gets on a SharePoint 2010 website when they check out a page. I've searched the internet for a fair bit of time and found that most users who have had errors checking out a page have had permissions issues and they got a different error message "Sys.WebForms.PageRequestManagerServerErrorException: Unknown error" or something like that.
Looking at the SharePoint logs, there are 2 unexpected errors from the correlation ID:
04/02/2012 15:19:54.62 w3wp.exe (0x17E0) 0x0BC4 SharePoint Foundation Runtime tkau Unexpected Microsoft.SharePoint.SPException: Trying to use an SPWeb object that has been closed or disposed and is no longer valid. at Microsoft.SharePoint.WebPartPages.SPWebPartManager.get_Web() at Microsoft.SharePoint.WebPartPages.WebPart.get_Web() at Microsoft.SharePoint.WebPartPages.XsltListViewWebPart.GetDataSource() at Microsoft.SharePoint.WebPartPages.BaseXsltListWebPart.AddDataSourceControls() at Microsoft.SharePoint.WebPartPages.DataFormWebPart.CreateChildControls() at Microsoft.SharePoint.WebPartPages.BaseXsltListWebPart.CreateChildControls() at Microsoft.SharePoint.WebPartPages.WebPartMobileAdapter.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 4512f8c5-eea1-4193-829f-65fd494864fa
04/02/2012 15:19:54.62 w3wp.exe (0x17E0) 0x0BC4 SharePoint Foundation General 90hv Unexpected Detected use of SPRequest for previously closed SPWeb object. Please close SPWeb objects when you are done with all objects obtained from them, but not before. Stack trace: at Microsoft.SharePoint.SPRegionalSettings.get_GlobalInstalledLanguages() at Microsoft.SharePoint.Utilities.ThemingLocations.GetThemableStylesFolders(SPSite site, Boolean includeFileSystem) at Microsoft.SharePoint.WebControls.CssRegistrationRecord.UpdateThemableReferences(SPSite site, IEnumerable`1 references) at Microsoft.SharePoint.WebControls.CssLink.Render(HtmlTextWriter output) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.HtmlControls.HtmlHead.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Page.Render(HtmlTextWriter writer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP._layouts_error_aspx.ProcessRequest(HttpContext context) at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) at System.Web.HttpServerUtility.Transfer(String path) at Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPage(String message, String linkText, String linkUrl) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorHandler(HttpApplication app, Boolean errorIsOnErrorPage) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.ErrorAppHandler(Object oSender, EventArgs ea) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.HttpApplication.RaiseOnError() at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error) at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) 4512f8c5-eea1-4193-829f-65fd494864fa
This error is obviously not caused by any code that I've written, it looks like a bug with SharePoint itself. Can anyone please tell me how to fix it?
The current work around for the user is to edit the page without checking it out, not sure if it still saves as a new version but it means people could possible work concurrently and cause problems.