TheWebs
TheWebs

Reputation: 12923

Debug FeatureActivated() in SharePoint WebForms

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.

Upvotes: 1

Views: 2126

Answers (3)

lildadou
lildadou

Reputation: 46

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)

Upvotes: 1

Igor
Igor

Reputation: 19

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.

Upvotes: 1

Raheel
Raheel

Reputation: 570

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

Upvotes: 1

Related Questions