Thursday, August 09, 2007

MOSS Debugging Tip

I found a very useful change in the web.config file of SharePoint when you need to debug something. If an exception occurs in your code, SharePoint will normally display a nice page with a generic “An error occurred” message. This is fine for end users but awful for debugging. To turn this off, change:

<safemode maxcontrols="200" callstack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">

To

<safemode maxcontrols="200" callstack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">

You will then get the typical ASP.NET error page with the exception and call stack.

No comments: