Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enable script debugging using Chrome in Visual Studio 11

I have a MVC 4 web Application with some javascript which is working fine with Internet Explorer and gives an issue with Chrome.

I was thinking to debug using Chrome as a browser in Visual Studio 11, which can be selected from the debug dropdown: the issue is that I cannot figure out how to enable script debugging : when I debug the breakpoint are disabled with the usual warning

No symbols have been loaded for this document

I know I might debug scripts directly in Chrome, but I prefer going consistent using Visual Studio, since it involves stepping into several lenghty js libraries.

I can see from a previous post that with Visual Studio 2008 that was not possible: does anyone know a way to do that with Visual Studio 11?

PS: attaching the Chrome process does not help as the debugging mode is 'Native' instead of 'Script'

PSII: I also tried to attach Chrome using the Attach to: Script Code option in the Attach.. menu (this switches the Debugging mode to Script) but that does not help as well.

like image 408
eddo Avatar asked May 24 '12 15:05

eddo


People also ask

How do I debug JavaScript in Visual Studio Code and Chrome?

To debug any project in either Chrome or Microsoft Edge, all you need to do is to start a session by pressing F5 or activating the debug icon in the menu bar and selecting “Run and debug”. Alternatively, you can also use the Visual Studio Code command palette and run the “Debug: Open Link” command.


2 Answers

You simply can't do this. Visual Studio only connects with IE in this way.


Chrome does of course have its own debugging tools that you can use, but you won't be able to get your stops inside of Visual Studio as you may hope.


There is a whole load of answered / unanswered / incorrectly answered questions all over the web and SO on the matter.

  • Visual Studio 2010 debugging Javascript with IE works but not with firefox or chrome. Any solution?
  • how to enable script debugging in visual studio 2008 when using Firefox
like image 77
Blowsie Avatar answered Oct 02 '22 07:10

Blowsie


Here are the steps that worked for me in Visual Studio 2015 (should work in earlier versions as well):

Start chrome in remote debug mode: chrome.exe --remote-debugging-port=9222 Attach Visual Studio: "Debug" -> "Attach to Process..." -> select the chrome instance

All credit goes to: http://lostindetails.com/blog/post/JavaScript-debugging-in-VisualStudio-with-Chrome

like image 36
July.Tech Avatar answered Oct 02 '22 09:10

July.Tech