Debug FeatureActivated() in SharePoint WebForms

2.1k Views Asked by At

Is it possible to debug FeatureActivated?

I am doing:

  1. Deploy ->
  2. Set Breakpoint in the public override void FeatureActivated ->
  3. Attach the process to the debugger ->
  4. refresh.

This doesn't work because the app has already been deployed and activated.

How do I tell it to insta-stop and let me walk through the activation process.

3

There are 3 best solutions below

0
On

deploy >> set break point >> attach process to debugger then goto site action >> site settings >> manager site features >> deactivate feature and then activate it again.

0
On

You can add the line to your code:

System.Diagnostics.Debugger.Launch();

Once the feature is activated, you will see Debug popup dialog and connect to the process.

0
On

Yes it is.

  1. Disable auto-activation at deploy time : Your SharePoint project > Properties > SharePoint > "Current deployement configuration" > Set "none"
  2. Deploy
  3. Attach the debugger : Debug > Attach process > select w3wp.exe
  4. Set some breakpoints
  5. Activate manually your feature : Site Settings > Site collection feature (if the feature's scope is site)