Home > sharepoint > Debugging SharePoint

Debugging SharePoint

While building custom SharePoint webparts one of the hardest things is usually debugging (unless you know how to set it up correctly).

At first I would just attach to the IIS worker process in Visual Studio to do all my debugging. To do this all you have to do is click Debug/Attach to Process… in Visual Studio. Then find the SharePoint process, it is usually the w3wp.exe process that is running under your SharePoint admin account. After doing that SharePoint will pick up breakpoints in your code.

While this is good, it can take a little bit of time and it doesn’t help to get errors from your testing team or environments you don’t have debug authority over. However, SharePoint does have a way to show errors (including call stacks) right on the SharePoint page. Usually, when there is a bug in SharePoint it redirects you to a generic error page without any information on what happened. And, if your lucky, you might get some error information in your logs(but not always :).

But, with a few web.config modifications you can get this error information to show up, on your webpage. First change the “CallStack” property to “true” in the “SafeMode” tag. Next change the “customErrors” tag “mode” to “off”. Now your SharePoint error page will show debug information.

Advertisements
Categories: sharepoint
  1. No comments yet.
  1. No trackbacks yet.

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

%d bloggers like this: