6

With VS2012 and IE9 I can use the VS2012 JavaScript debugger from within VS2012 (similar to C#, ..). When I switch the browser to Chrome, I loose the ability to do so. I could switch to the the Chrome intrinsic debugger.

Chrome as browser

But, is there a way to get debugging with Chrome working with VS2012 (similat to IE)?

Example: Breakpoint hit with IE, but not with Chrome as browser.

Breakpoint

Remark: No duplicate of Debugging Websites with Google Chrome which is about .net debugging. I am not using any ASP.net, only JavaScript

1
  • This appears to require much more cooperation between Microsoft and Google than I would expect either would be willing to offer. Commented Feb 4, 2013 at 10:38

4 Answers 4

16
+100

No it's absolutely impossible to debug JS in Chrome from VS, because it's a completely different internal engine. May be somebody will write a plugin for VS, but right now it's not possible.

Sign up to request clarification or add additional context in comments.

1 Comment

exactly. no addition required.
6

inside a javascript place a "debugger;" command and refresh the page.

works in CHROME v30> and IE 10>

Example:

<script type='text/javascript'>
        function LoginEstabelecimento() {

            var form = $('form#formLoginEstabelecimento');

            debugger;

           ... SOME REST OF CODE ...

        };
</script>

1 Comment

no way, how would it work? does not for me for sure.
3

You can always right click the page in Chrome, choose 'inspect element' and use chrome's built-in javascript debugger.

Comments

3

This is now possible. See this page for how, but in a nutshell (using Windows 10 1607, Visual Studio 2015 with Update 3):

  1. Close all Chrome windows (this is important)
  2. From the Run prompt "chrome --remote-debugging-port=9222" (without quotes)
  3. In Visual Studio, start your application with Chrome as the browser. This opens your page in a new tab.
  4. In Visual Studio, with the application still running, click Debug -> Attach to Process... -> select the Chrome process that is running you page.
  5. This should attach to the process without any error and your break points in Visual Studio should now get hit.

Also, see this page which confirms this feature will be added to a future Visual Studio release.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.