简体   繁体   English

在Visual Studio 2010中为IE中的BHO使用断点

[英]Using breakpoints in visual studio 2010 for BHO in IE

I'm developing a BHO in Visual Studio 2010. So far I've managed to register the BHO and get visual studio launch IE when I hit debug. 我正在Visual Studio 2010中开发BHO。到目前为止,我已经设法注册了BHO,并在单击debug时使Visual Studio启动IE。 The BHO works as expected but unfortunately break points that I set are never hit. BHO可以按预期工作,但不幸的是,我设定的断点从未达到。 Is there something that needs to be configured first? 是否需要先配置一些东西?

If you're using .NET 4.0 the debugger won't attach properly to IE. 如果您使用的是.NET 4.0,则调试器将无法正确连接到IE。 So here is what you do: 因此,这是您的工作:

Run Visual Studio as an administrator. 以管理员身份运行Visual Studio。

Add the following code to your BHO: 将以下代码添加到您的BHO:

Debugger.Break();

Experiment a bit with placement; 尝试摆放位置; I'd say set it after the site is set. 我想说的是在设置网站之后进行设置。

Run Internet Explorer independently of Visual Studio. 独立于Visual Studio运行Internet Explorer。 As in don't launch IE from within Visual Studio. 如不要在Visual Studio中启动IE。 When IE runs you will get a crash window (the result of the code above); 当IE运行时,您将获得一个崩溃窗口(上面代码的结果)。 that's when you can attach Visual Studio to IE. 那是您可以将Visual Studio附加到IE的时候。 Done and done. 做完了。

请参考此处以获取正确连接调试器和调试BHO项目所需步骤的完整说明。

Are you sure you have registered the 'debug' dll and not the release one (that didn't contain debugging information) ? 您确定已注册了“调试” dll,而不是发布版本(不含调试信息)吗?

Personally I created a scrip that register the dll and this script is executed each time I compile (post-processing). 我个人创建了一个脚本来注册dll,并且每次编译(后处理)时都会执行此脚本。

Hope that help ! 希望对您有所帮助!

EDIT: 编辑:

I'm using VS 2008 but could you check if your configuration correspond to mine ? 我使用的是VS 2008,但是您能否检查您的配置是否与我的相对应? 替代文字

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM