开发者

FeatureActivated event receiver not called for sandboxed feature

I have a sandbox feature, and I've added two event receivers - FeatureActivated and FeatureInstalled. The FeatureInstalled event handler executes, if I attach to t开发者_开发百科he 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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜