1
votes

I have a sandbox feature, and I've added two event receivers - FeatureActivated and FeatureInstalled. The FeatureInstalled event handler executes, if I attach to the SPUCWorkerProcess and the SPUCHostProcess I can debug the code. However, my breakpoints in the FeatureActivated code are not hit. Also, though in the project properties I have selected the No activation option, in the Solution gallery the feature is always activated.

How can I debug the FeatureActivated event handler in a sandboxed solution? I've also tried Debugger.Break, but it does not work.

2

2 Answers

1
votes

Features don't go in the Solution gallery, only solutions do. You need to attach to all of the w3wp processes and the SPUCWorkerProcesses then go to Site settings -> site features and manually activate. It should hit your breakpoint then.

0
votes

There are couple of options:

  • Use System.Diagnostics.Debugger.Launch() to launch the debugger irrespective of where the feature is activated.

  • Use DebugView and use Debug.WriteLine() to write debug statements.