Visual Studio Community 2015 JavaScript Console grayed out - javascript

I simply have an empty web project with 1 html file, 1 css file, and 1 JavaScript file. I saw a tutorial where the guy was debugging in VS in a JavaScript console window... like you see in most browser's dev tools.
I F5 to debug my project and go to Debug > Windows > JavaScript Console .. and it is grayed out. Do I have to set something up first or am I missing a component?

I just realized that the JavaScript console option is only available when I am debugging using Internet Explorer. I was using Chrome. I guess that makes sense.

Related

How can you pretty print all javascript files automatically in Google Chrome? [duplicate]

As part of our build the code is minimised I'm currently debugging some js and constantly have to click the pretty print button in chrome dev tools. Is there a way to permanently enable pretty printing in chrome dev tools ?
Yes!
This has become available:
In Dev Tools:  ⋮ > Settings (F1) > Experiments > Automatically pretty print in the Sources Panel.
No it is not possible yet. The way that I do is that I manage it through the build process to not minify the CSS and JS.

Debug Java Script code in Visual Studio 2010

I'm writing a visual studio project template using the .vsz method(Custom Wizard) on Visual Studio 2010.
I got an auto-generated Java Script file named default.js, which some base code, and I expanded the code according to my own needs.
Now I'ld like to debug the Java Script code, and I didn't find any way to so so.
so I have the VS 2010 IDE opened on my desktop, with the default.js file opened on it. Till now I just saved the code changes I made, with ctrl+s, closed the VS, opened a new instance of VS, and saw the changes actually.
But now I got into troubles which I must debug the JS code in order to solve them..
I tried going to Internet Explorer->Tools->Internet Options->Advanced->and cleared the *Disable script debugging (Internet Explorer) and the
*Disable script debugging (Other) checkboxes, then I tried to put a breakpoint in the .js code in VS, but nothing happened...
Do you know what I have to do else in order to debug this script?
You have several ways:
Write debugger in your .js code wherever you want to start debugging. Upon reaching that code you'll be transferred to the VS and you'll be able to debug.
You can use your browser's developer tools. For instance, in Chrome you can press F12 to bring up the developer tools, and find your code under the Sources tab. From there, you can click on your line of code and it will bring up debugging when you reach that code.
Same goes for other browsers.

Visual Web Developer Express Javascript Breakpoints not hit

I'm using Visual Web Developer Express 2012 for Web.
I'm facing an issue performing debugging. It says, "this breakpoint will not be hit, no symbols have been loaded for this document" while debugging.
I'm using IE to run my website project and currently using my IE debugger. This is too much of a task and debugging is very difficult this way, because, everytime I close the browser, I lose all the breakpoints set and have to do it again.
I want to debug using the IDE and not the browser debugger.
In IE9 (only one instance): Tools > Internet Options > Advanced tab > In Browsing category > Clear "Disable script debugging" check boxes (both) > restart IE.
In VS 2012: Run the Page Inspector ( when javascript error box opens, click No ! )
Choose from VS menu: DEBUG > Attach to process...
Select your IE instance and click Attach.
Debugging works pretty well, but it's one condition. Don't insert any breakpoints in your code (or clear them before - DEBUG > Delete All Breakpoints). There can cause a lot of problems - from hanging and frozing to entirely crashing your VS.
You can also get some help here: http://msdn.microsoft.com/en-us/library/7seh8d72.aspx
Hope this helps.
I happened to fix this issue of breakpoints not getting hit by doing a clean installation of VSW express 2012. It works well after that.

Debug JavaScript in Visual Studio 2010?

Currently I am debugging my JavaScript using Firebug for Firefox. Is there anyway to debug javascript in Visual Studio 2010? The JavaScript isn't part of any Visual Studio project, it's just a .js file that will be linked to a static HTML page (it's to debug school assignments).
I did try searching and the results weren't any more recent than around a year ago. I'm hoping something has changed or there is a better workflow than notepad++ for HTML/JavaScript and Firebug for debugging.
Use the JavaScript debugger keyword in IE.
function onClickRow(detailUrl) {
debugger;
}
When run your page in IE, a debug window will pop up, then select Visual Studio 11.
To use debug in Internet Explorer, you need perform these steps:
enable script debugging in IE (go to Internet options->advanced->browsing and uncheck 'Disable script debugging')
select view->external script debugger->break on next statement
When next javascript statement will be reached, IE will show standard windows debugger selection dialog, when you can select instance of visual studio.
Update:
With visual studio you can attach to browser process(e.g. iexplore.exe) and then debug
This question gets a lot of views so for the sake of completeness I just wanted to mention that I've been using Chrome Developer Tools for a while now. It's been working great for me and is what I recommend now when people ask me this same question.
Yes, but only in IE. Basically just create a web-page project and hit run. It'll launch IE in debugger mode.
disable option from Internet Options like here : http://www.mayanksrivastava.com/2010/02/debugging-java-script-in-visual-studio.html
If you installed VS 2012 and then uninstalled it, you may need to Re-Install Visual Studio 2010.
Error you may get when trying to debug JavaScript:
---------------------------
Microsoft Visual Studio
---------------------------
Unable to attach to the crashing process. The correct version of pdm.dll is not registered. Repair your Visual Studio 2010 installation, or run 'regsvr32.exe "%CommonProgramFiles%\Microsoft Shared\VS7Debug\pdm.dll"'.
---------------------------
OK
---------------------------
If you want to try giving it a shot in IE, I posted about using the js debugger here:
jQuery/Ajax content not appearing/loading in Explorer

How do I debug JavaScript in Visual Studio 2005?

I just saw this mentioned in Stack Overflow question Best WYSIWYG CSS editor and didn't know it could be done. I'm a Visual Studio newbie, so how do you do it?
Is there a separate debugger for JavaScript? I know how to work the one for code-behind pages... I usually use Firebug to deal with debugging JavaScript code.
I'm using Visual Studio 2005.
I prefer using Firebug for projects I can't use Visual Studio 2008 on.
To debug in Visual Studio 2005, make sure that "disable script debugging" is unchecked. Then load your webpage in Internet Explorer. From the debug menu inside of Visual Studio 2005, select "Attach to process" and pick the instance of Internet Explorer that has your web page loaded.
Alternatively, the Firebug team has been working on a "lite" version that you can include either as a script in your page or by launching it via a bookmarklet from your browser. It doesn't provide the full debugger that Firebug does, but it gives you a console and a command line from which you can inspect variables and log things to the console.
Visual Studio 2008 ASP.NET projects has debugging enabled by default. You can set breakpoints within your .js file while the website/web app project is run in the ASP.NET debug server.
TechRepublic has a good walk through - see Visual Studio 2008 simplifies JavaScript debugging.
Just make sure you have 'Disable Script Debugging' unchecked, and just hit F5 to start debugging in VS2005 or 2008.
I would also note that if you have your JavaScript inside the .aspx page you will have to find it via the script explore. However if you have it in a separate .js file you can just put a break point on it like you would any .cs file.
In Internet Explorer, select View -> Script Debugger -> Open. That should do it.
Usually you know where you are having problems, so you can set a breakpoint in your JavaScript code by placing the keyword "debugger;" on a line in your JavaScript code (obviously without the quotes) to set a breakpoint.
When you get to it in Internet Explorer, it will ask you if you want to debug and prompt you to choose a debugger from a list, hopefully you will see Visual Studio in that list (both a new instance as well as your currently-running instance) - if you are using Firefox with Firebug, it will automatically stop execution on that line and you will be within the Firebug debugger, not Visual Studio.
You will want to do the following to setup Internet Explorer for doing this - from within Internet Explorer, follow this menu path: Tools > Internet Options > Advanced Tab > Uncheck the "Disable Script Debugging" options.
You can set a breakpoint within JavaScript in Visual Studio 2005, but in addition to debugging needing to be enabled in Internet Explorer, you can only set the breakpoint in a .js file. You cannot debug any inline JavaScript code.
I also sometimes have problems when trying to debug my JavaScript code when using the attach process method to go into debugging. I will normally use the "Start debugging" green arrow. You will know that your code will stop at the breakpoint in your .js file if the breakpoint icon (Burgandy Circle by default) is filled in. If it's not filled in, you will never stop there.
Finally, make sure you have debugging enabled in your ASP.NET configuration settings.
Debugging client JavaScript code in Visual Studio 2005:
Add the following code to the start of the JavaScript code:
debugger
See Debugging client JavaScript in Visual Studio 2005.
Yeah using Microsoft Script Editor is a an option if you have Office XP or Office 2003 installed. In IE uncheck Disable Script debugging (Internet Explorer) and Disable Script debugging (Other).
Restart IE. In View menu you will have a new item, "script debugging", choose open. You will be given a choice of VS2005 or New instance of Microsoft Script Editor, choose that and give it a go.
Edit: try this link for a tutorial
I usually use Firebug to deal with debugging JS.
Unless you need to debug in IE, there's no need to stop using Firebug. It works with JavaScript in ASP.NET pages just as well as it does with any other type of page.
Visual Studio's JavaScript debugging is alright, but really cannot compete with the full range of client-side information that Firebug aggregates.

Categories