views:

38

answers:

3

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 http://blogs.msdn.com/b/sharepoint/archive/2007/04/10/debugger-feature-for-sharepoint.aspx

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!

+2  A: 

Hi there.

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. Jas.

Jason Evans
The name of the process you need to attach to is w3wp.exe. Make sure "Show all processes from all users" is checked. There may be more than one instance (easiest thing to do is just to attach to all of the w3wp.exe processes listed).
Kit Menke
The SharePoint timer service was OWSTIMER.exe and attaching to it didn't seem to hit the FeatureActivated method when activating the feature through Site Collection Features.
Eric U.
@Eric U. - OK, maybe @Kit has the right idea, to attach to `w3wp.exe` instead. It's got to be one of these .EXE's, been a while since I've done this myself.
Jason Evans
Ahh, just found this: http://stackoverflow.com/questions/2581193/how-to-debug-sharepoint-solution-feature-through-visual-studio might be useful? Looks like @Ben Robinson was on the right track.
Jason Evans
+1  A: 

You will find it much easier to do this using SPVisuaDev it is a VS add in and you can select Activate(with debug) in a menu,you don't even need to use stsadm to deploy or activate your features in your dev environment. It also integrates with WSPBuilder which makes building and deploying your WSP packages much easier.

Ben Robinson
A: 

I'm pretty sure feature activation would happen in w3wp if you're doing it from the browser and stsadm if you're doing it from stsadm. Powershell in the case of powershell with 2010. The timer service isn't involved in these sorts of provisioning tasks. They're all synchronous.

James
Nope, attaching to w3wp does not trigger the breakpoint on the FeatureActivated method.
Eric U.
Have you checked the ULS logs (program files\common files\microsoft shared\web server extensions\[12/14]\logs) to see if there's anything regarding the feature activation? Are you 100% sure the feature receiver is in fact running?
James