Searching For An Error?


So lets say you create a new site based on the Team template and you would like to create a search center site under that same site collection. So you navigate to Site Actions – New Site and maybe you choose the Enterprise Search Center template and provide a name for your new site and hit “Create”. Well you may be presented with an error like this one…The dreaded unexpected error has occurred error, yuk (failure #1).

Well no worries right, you have the ULS log to query for a hint. While the dialog here provides a correlation ID you can look for in the ULS logs you cannot copy it from this dialog (failure #2) but you can still query the ULS log for entries that match this ID and you will hit upon an entry which a nice looking stack – once you factor the stack out of the ULS entry it will look like the following.

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.WebControls.ScriptLink.SharePointClientJs_Register(Page page)     
at Microsoft.SharePoint.WebControls.ScriptLink.InitJs_Register(Page page)     
at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language)     
at Microsoft.SharePoint.WebControls.ScriptLink.Register(Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion)     
at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Page page, String strKey, String strFile, Boolean localizable)     
at Microsoft.SharePoint.WebControls.ScriptLink.RegisterCore(Page page, Boolean defer)     
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.RegisterOWSScript(Page page, SPWeb web)     
at Microsoft.SharePoint.WebPartPages.WebPartPage.FormOnLoad(Object sender, EventArgs e)     
at System.Web.UI.Control.OnLoad(EventArgs e)     
at System.Web.UI.Control.LoadRecursive()     
at System.Web.UI.Control.LoadRecursive()     
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_addgallery_aspx.ProcessRequest(HttpContext context)     
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     
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)

So this does not really give us anything to go on here but it would appear there is a bug where someone is probably disposing of an SPContext.Current object – still nothing we can do about that.

So lets attach WinDbg to the correct w3wp process and retry the operation. Once reproduced lets look at what was spit to the debugger….

<<snip>>
(14f4.11c0): CLR exception - code e0434f4d (first chance)
(14f4.11e8): CLR exception - code e0434f4d (first chance)
(14f4.11e8): CLR exception - code e0434f4d (first chance)
(14f4.11e8): CLR exception - code e0434f4d (first chance)
(14f4.11e8): CLR exception - code e0434f4d (first chance)
(14f4.ec0): CLR exception - code e0434f4d (first chance)
(14f4.ec0): CLR exception - code e0434f4d (first chance)
(14f4.ec0): CLR exception - code e0434f4d (first chance)
(14f4.ec0): CLR exception - code e0434f4d (first chance)
(14f4.ec0): CLR exception - code e0434f4d (first chance)
CLR exception type: System.InvalidOperationException
    "The SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated."
(14f4.ec0): CLR exception - code e0434f4d (first chance)
CLR exception type: System.InvalidOperationException
    "The SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated."
(14f4.ec0): CLR exception - code e0434f4d (first chance)
CLR exception type: System.InvalidOperationException
    "The SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated."
(14f4.ec0): CLR exception - code e0434f4d (first chance)
CLR exception type: System.InvalidOperationException
    "The SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated."
(14f4.ec0): CLR exception - code e0434f4d (first chance)
CLR exception type: System.InvalidOperationException
    "The SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated."
(14f4.ec0): CLR exception - code e0434f4d (first chance)
CLR exception type: System.InvalidOperationException
    "The SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated."
(14f4.ec0): CLR exception - code e0434f4d (first chance)
(14f4.ec0): CLR exception - code e0434f4d (first chance)
CLR exception type: System.InvalidOperationException
    "The SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated."
(14f4.11e8): CLR exception - code e0434f4d (first chance)
(14f4.ec0): CLR exception - code e0434f4d (first chance)
(14f4.11e8): CLR exception - code e0434f4d (first chance)
(14f4.ec0): CLR exception - code e0434f4d (first chance)
(14f4.ec0): CLR exception - code e0434f4d (first chance)
(14f4.ec0): CLR exception - code e0434f4d (first chance)
(14f4.11e8): CLR exception - code e0434f4d (first chance)
(14f4.11c0): CLR exception - code e0434f4d (first chance)
(14f4.11e8): CLR exception - code e0434f4d (first chance)
(14f4.11e8): CLR exception - code e0434f4d (first chance)

OK now I have something to go look at. Sure enough on my Team site I did not have the Site Collection Feature SharePoint Server Publishing Infrastructure enabled. Once I enabled this feature I retried the operation and sure enough the problem was resolved. So failure #3 was assuming the ULS was giving me the best error available. I suspect the error being reported was due to a bad code path which we took once the source error was encountered.

 

 

 

3 thoughts on “Searching For An Error?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s