Tuesday, May 25, 2010

Nice Tool to Troubleshoot SharePoint Exceptions

When developing custom solutions for SharePoint 2007 (or WSS3.0) it might at times be very challenging to troubleshoot exceptions.

The exceptions can be caused by anything from the underlying SQL database (eg. incorrect roles assigned or a full log file) to Native SharePoint problems.
(many cases by incorrect usage of the SP object model during custom assembly development).

Many times SharePoint will only provide an user with an error description as follows:
HRESULT: 0x80004004 (E_ABORT))
Cannot complete this action – please try again.

It is therefore very hard for a developer, administrator or tester to pinpoint the problem.

The UBER COOL news is that there is a nice utility to help to monitor SharePoint diagnostic tracing.

SPTraceView moniors in real time all SharePoint diagnostic tracing (also called ULS tracing) and can notify you using a balloon-style messages in the tray bar when any information of particular interest to you is sent (traced) by any of the MOSS services and components.

For example if you haven’t disposed all SPSite/SPWeb objects properly from your code, which also will cause unmanaged memory leak, you will see a message similar to the one below as soon as the page that contains your web part is rendered:

Even configuration errors will be shown:

Because SPTraceView processes the tracing in real time you can identify errors and events as they happen. That is as soon as you interact with the SharePoint GUI when testing/debugging your custom SharePoint solutions including web parts, event receivers, workflows and all other SharePoint technology components.

As soon as you run it, SPTraceView will start receiving all messages from MOSS and will start checking if any of them match filters defined by you. The default filter matches all messages which severity level is: Critical Event, Unexpected, Exception, Warning Event, Assert or Unassigned.

If you click on the SPTraceView icon in the windows tray you will notice the following action menus:

You can configure your settings by choosing “Configure” from the context menu. The configuration form will show up and you will be able to choose the monitored levels and what you want SPTraceView to do when any of the messages match your filter.

SPTraceView allows more complex include/exclude filters to be configured by selecting the “More Settings” button.

If you want to intercept the trace messages from more than one server in your farm you will need to have SPTraceView running in each of the servers you want to monitor
The default option is a “Local Machine Viewer” (also called “Stand Alone Viewer”). In this mode SPTraceView will only capture and process the trace messages on the local machine. This is probably what most developers need when they develop in a single server farm or virtual machine.

To view the list of historic messages, double click on the SPTraceview icon in the system tray and you will see the following window:

For more information check out http://sptraceview.codeplex.com/


Lionel Skinner said...

It was the SharePoint 2010 Site Directory web Part from Code Plex that was causing the access denied error message. Once I removed that from the default page.

digital signatures said...

Excellent! Thanks for this - I've been looking at this feature for ages. Followed your instructions and it works a treat!

Post a Comment