沙盒功能未调用 FeatureActivated 事件接收器
我有一个沙箱功能,并且添加了两个事件接收器 - FeatureActivated 和 FeatureInstalled。如果我附加到 SPUCWorkerProcess 和 SPUCHostProcess,则执行 FeatureInstalled 事件处理程序,我可以调试代码。但是,我在 FeatureActivated 代码中的断点没有被命中。另外,虽然在项目属性中我选择了“不激活”选项,但在解决方案库中该功能始终处于激活状态。
如何在沙盒解决方案中调试 FeatureActivated 事件处理程序?我也尝试过 Debugger.Break,但它不起作用。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
功能不会出现在解决方案库中,只有解决方案才会出现。您需要附加到所有 w3wp 进程和 SPUCWorkerProcesses,然后转到站点设置 ->站点功能并手动激活。然后它应该会到达你的断点。
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.
有几个选项:
使用
System.Diagnostics.Debugger.Launch()
启动调试器,无论在何处激活该功能。使用 DebugView 并使用
Debug.WriteLine()
编写调试语句。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.