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. The BHO works as expected but unfortunately break points that I set are never hit. Is there something that needs to be configu开发者_如何学Gored first?
If you're using .NET 4.0 the debugger won't attach properly to IE. So here is what you do:
Run Visual Studio as an administrator.
Add the following code to your 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. As in don't launch IE from within Visual Studio. When IE runs you will get a crash window (the result of the code above); that's when you can attach Visual Studio to IE. Done and done.
Are you sure you have registered the 'debug' dll and not the release one (that didn't contain debugging information) ?
Personally I created a scrip that register the dll and this script is executed each time I compile (post-processing).
Hope that help !
EDIT:
I'm using VS 2008 but could you check if your configuration correspond to mine ?
Please refer here for a complete description of steps needed to properly attach the debugger and debug a BHO project.
精彩评论