I would like to know if I can use the debugger in VS 2012 for javascript code in a webbrowser control for a winform app. I'm not talking about debugging in a web browser such as IE as this is not how I am running the code. I have tried placing "debugger;" in my javascript code but it still runs through it and does not stop.
Here is an example of how I am using it.
function addDeleteButton(poly, imageUrl) {
debugger;
var path = poly.getPath();
path["btnDeleteClickHandler"] = {};
Thanks to Borys Generalov for this answer!
The instructions for this can be found here http://blogs.perl.org/users/mark_leighton_fisher.
You can debug JavaScript executing inside a WebBrowser control embedded in your .NET 4.0 application from VS2010 (Visual Studio 2010), but it takes a little effort.
- Enable Script Debugging (both IE and Other) in Internet Explorer.
- Disable friendly HTTP messages in Internet Explorer.
- Enable Display a notification about every script error in Internet Explorer.
- Modify VS2010 to debug Script from the Attach Process dialog. Please note that you cannot debug both JavaScript (Script) and .NET 4.0 code at the same time. (I don't know why.)
- Add a debugger; statement at the start of your JavaScript.
- Start your WebBrowser-embedded application without debugging (Ctrl-F5).
- When your application hits the JavaScript debugger; statement, select your current instance of VS2010.
- Voilà! You can now debug the JavaScript executing inside the WebBrowser control in your .NET 4.0 application.
This needs to be done regardless of ever using IE when debugging or running your code in VS 2012.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With