Search code examples
c#visual-studio-2008sharepointdebuggingsharepoint-2007

Debugging feature activation in SharePoint 2007


I have a SharePoint feature that is activated under 'Site Collection Features' that is having some issues being activated. I've activated it through the stsadm as well as the SharePoint UI, both unsuccessful. The feature toggles from deactivated to activated, but the result that should be there is not. The result is some pages that should be created. So my question is does anyone know of a way to step through the activation of features process? I'd like to be able to attach Visual Studio 2008 to the browser and step through a few breakpoints that I've set.

I've narrowed the error down to the FeatureReceiver's FeatureActivated(SPFeatureReceivrProperties properties)

Pages that I've been referencing:

http://msdn.microsoft.com/en-us/library/ee231550.aspx Link

EDIT: The solution was resolved by looking at the errors created in Logs folder under 12 hive, starting with the first error of importaning a web-part, and referencing http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/06/troubleshooting-cannot-import-web-part-error.aspx

The issue was resolved by adding two missing binaries. I was unable to attach to SharePoint feature activation by attaching to w3wp and SP Timer Service process.

Thank you all for your tips!


Solution

  • One thing you could try is this (assuming Visual Studio is installed on the same computer as the SharePoint server itself).

    • Put a breakpoint on the FeatureActivated(SPFeatureReceivrProperties properties) method.
    • Attach Visual Studio (Debug menu-> Attach To Process) and look for the SharePoint Timer Service (the name of which escapes me right now)
    • Immediately, try to activate your feature.

    If I recall, the timer process is responsible for firing off various tasks, such as feature activation, so hopefully attaching to that process will be correct.

    Hopefully the above might work, assuming you're using a DEBUG build of your code, you should be able to debug your code.

    Hope this helps.