Sunday, February 18, 2007

Sharepoint Error Details

Anyone developing on MOSS or WSS v3 is aware of how frustrating the useless error messages received in the interface can be ("Unknown Error Occurred"), and often these are not at all accompanied by a message in the ULS logs.

I was having a terrible time with a new master page I was deploying, and finally realized something that should have been very obvious, but in case you missed it too, here is how you enable more detailed error messages for your portal:

  1. Open up your sites web.config, and make the standard custom errors edit. You want it to be < customerrors mode="Off"/>
  2. Then, something a bit less obvious, search for the CallStack="False" and change it to CallStack="True", you should find this in the "<safemode>" node.

8 comments:

sud said...

This is a very useful tip. Thanks!

Kindler said...

Doh! Don't know why I didn't think of the web.config file.

Thanks for the great tip!

Anonymous said...

I knew about the customErrors part but not about the CallStack. Thanks!

Anonymous said...

this post just saved my day! thanks a lot!

Vinayh said...

Thanks for the tip. Hope to use it next time onwards.

Ryan said...

Not sure what I did wrong, I simply changed those two things and then I got this error once:

Event code: 3008
Event message: A configuration error has occurred.

and my users would receive this error every few minutes:

Event code: 3005
Event message: An unhandled exception has occurred.

I have since reverted to before I made the changes and all is well again. Any ideas?!

Thanks, Ryan

Ryan said...

Here is the full error I was getting constantly:

Event Type: Warning
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1309
Date: 3/10/2008
Time: 11:25:11 AM
User: N/A
Computer: ********
Description:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 3/10/2008 11:25:11 AM
Event time (UTC): 3/10/2008 4:25:11 PM
Event ID: 26afc32c75db48b98472d648f55c9bcf
Event sequence: 202
Event occurrence: 1
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/1321855695/Root-2-128496397980148363
Trust level: WSS_Minimal
Application Virtual Path: /
Application Path: C:\Inetpub\wwwroot\wss\VirtualDirectories\80\
Machine name: ********

Process information:
Process ID: 5232
Process name: w3wp.exe
Account name: GBPORTAL\SP_Admin

Exception information:
Exception type: InvalidOperationException
Exception message: Collection was modified; enumeration operation may not execute.

Request information:
Request URL: http://********/default.aspx
Request path: /default.aspx
User host address: 10.157.10.62
User: *********
Is authenticated: True
Authentication Type: NTLM
Thread account name: ********

Thread information:
Thread ID: 19
Thread account name: ********
Is impersonating: True
Stack trace: at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
at System.Web.UI.ControlBuilder.ProcessAndSortPropertyEntries(ArrayList propertyEntries, FilteredPropertyEntryComparer& comparer)
at System.Web.UI.FileLevelPageControlBuilder.SortEntries()
at System.Web.UI.ControlBuilder.InitObject(Object obj)
at System.Web.UI.FileLevelPageControlBuilder.InitObject(Object obj)
at System.Web.Compilation.BuildResultNoCompileTemplateControl.FrameworkInitialize(TemplateControl templateControl)
at System.Web.Compilation.BuildResultNoCompilePage.FrameworkInitialize(TemplateControl templateControl)
at System.Web.UI.TemplateControl.FrameworkInitialize()
at System.Web.UI.Page.FrameworkInitialize()
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Custom event details:

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Stefan Keir Gordon said...

Ryan:

That's extremely odd. Perhaps you have a customer web part that is throwing an error some where? Odd that enabling stack trace details would cause it to show up though.