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"] = {};
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"] = {};
Share
Improve this question
edited Jul 10, 2014 at 16:59
Programmer
asked Jul 10, 2014 at 15:02
ProgrammerProgrammer
4795 silver badges21 bronze badges
4
- Did you try to enable client side debugging only? Is debugging enabled in Internet Explorer as well? – Borys Generalov Commented Jul 10, 2014 at 16:20
- I am not using IE since this is in a WinForm app and the code is in a WebBrowser Control. – Programmer Commented Jul 10, 2014 at 16:58
- 1 Right, but enabling these options are still needed. Check this link for example: blogs.perl/users/mark_leighton_fisher/2011/09/… – Borys Generalov Commented Jul 10, 2014 at 17:10
- I guess I was confused at to what you meant by using Internet Explorer and how it pertained to the subject. That was my fault i guess. It worked, thanks a lot! – Programmer Commented Jul 10, 2014 at 17:31
1 Answer
Reset to default 16Thanks to Borys Generalov for this answer!
The instructions for this can be found here http://blogs.perl/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.