Breakpoints not hit in javascript files in Visual Studio - javascript

I am experiencing some weird behaviors when debugging my MVC Web Application. Some days I experience these issues, but other days everything works fine.
The breakpoints in my javascript files are not getting hit. I get the dreaded "The breakpoint will not currently be hit. No symbols have been loaded for this document." error.
The debugger will detach from the process without me clicking the Stop Debugging button.
I have tried everything I can think of including:
Refreshing the page in IE to force the browser to get the latest version of the javascript files.
Clean / Rebuild the application in Visual Studio
Close / Reopen Visual Studio
Delete all files from bin and obj folders and rebuild
Cleaned up all old sites from my IIS Express applicationhost.config file
Installed VS2013 Update 4
Deleted / Reinstalled VS2013
Removed / Added IE11
Installed VS2015. Same behavior as VS2013
Deleted all local project files and performed a "Get Latest" from TFS
I can manually attach the debugger to an iexplore process and then I'm able to debug that specific file, but it seems like there is a different iexplore instance for each javascript file. I end up having to guess which one to use for each javascript file. To top it off, the debugger keeps detaching in the middle of me trying to find the right process to attach to. It is nearly impossible, and definitely not feasible to try and debug this way.
Our solution is in TFS, we're using IS Express and the three other developers on our team have none of the problems I have. We all have the exact same hardware.
Another clue that might help is that we are using the OWIN functionality to connect to ACS for security. If I bypass authentication through OWIN / ACS I can step into the javascript. This, however, creates other problems since the code is expecting me to be authenticated. This is not an acceptable workaround and, again, the other developers on the team are using OWIN/ACS and do not have any problems.
I'm extremely frustrated and at a loss for how to go about figuring our what is wrong with my environment. Any help will be greatly appreciated.

Related

How to debug javascript with Eclipse running local Tomcat server

There are a lot of questions on SO about how to debug a standalone piece of Javascript - that isn't what I want. None of the previous Eclipse/javascript questions seem to be on point, which surprised me.
I am using Eclipse for Java EE (Neon, the latest version) to develop a JSP/servlet website - a full website, not just javascript, and not just java/jsp - everything together. I can compile my Java and "debug as" on an instance of Tomcat spawned by Eclipse, and the web pages show up inside of a window in Eclipse. I can set and hit Java breakpoints all day long while using "debug as" - but setting breakpoints in javascript doesn't do diddly squat. I've been having to run a standalone instance of Tomcat, deploy war files to it, wait for the war files to decompress, then debug my Javascript inside of Firefox. This is particularly annoying because I'm relatively new to javascript and am doing some complex things on the page (and truth be told, making some silly mistakes a compiler in a typed language would catch for me before letting me waste my time trying to run the code) and the "change, watch Eclipse chew deploying war, wait for Tomcat to chew uncompressing the war, test" cycle is just unacceptably long.
Isn't there an easier way to debug BOTH java and javascript from the same IDE without having to export and deploy WAR files? Is there is a setting I can toggle or something I can install in Eclipse to make it an all-in-one IDE? Ideally I would like to be able to step through, for example, an AJAX call into my servlet AND watch what happens in the javascript after it returns - within the same debugging session - so let me preemptively state that copying the changed js file(s) directly to the decompressed folder in tomcat/webapps as a faster way to continue to do split debugging is not the kind of "workaround answer" I'm looking for.
JavaScript debugging is going to be supported in Eclipse Neon 1 release (September 2016). Here is a demo video in which step-by-step process of debugging both front-end and back-end is explained - https://youtu.be/7oQz1Ja1H08 .
Basically, running Chrome / Chromium with extra parameters and tuning source mapping manually is not really user-friendly now, but we are going to improve it for Neon 1 and future releases.
Contributions of any kind are most welcome ;)

Debugger not working in visual studio

My debugger stopped working as expected in Visual Studio Community 2015 (Update 1).
The solution I'm working on has the following architecture:
"Query" project - written with angularjs 1.4
"Login" project - written with angularjs 1.4
More back-end projects - written with c#/web-api
I run the Query project, it checks for session and redirect to Login. After the login is successful it makes another redirect back to the Query url.
Until yesterday I had no issues debugging the whole solution from VS directly.
Now the behavior is that the first time I run the "Query" project, my breakpoints get hit. After coming back from Login, no breakpoint is hit.
Both client-side projects are hosted using IIS Express.
Things I tried until now:
clean, build, rebuild the solution;
attaching to process from VS. I attached to all IIS Express processes but with no luck;
closing VS and deleting my bin and obj folders from all projects;
restarting the machine;
Also good to mention that I have set in web.config:
<compilation debug="true"></compilation>
Any hint or idea is highly appreciated.
After trying more different solutions, the only thing that worked in my case was to unload/reload the project.
Also, now the breakpoints that I set before the application runs are no longer getting hit, but if I set them after the application started then they work fine.
I can suggest some Stack Overflow answers related to this issue, maybe it helps:
New project and just importing the files into it: Upgrade to Visual Sudio 2015 and now can't hit break points in debuging
Manual check of the Symbol Load Information: Fixing "The breakpoint will not currently be hit. No symbols have been loaded for this document."
Incorrect configuration selected in the debug menu: Visual Studio breakpoints not being hit
In my case (Vs2019) the Microsoft Symbol server was causing the issue.
It was not being able to attach Local IIS.
Enabling only the NuGet Symbol server and disabling the Microsoft worked for me

Visual Studio 2015 JavaScript Intellisense strange behaviour

I am working on MVC application in Visual Studio 2015. Suddenly, intellisense for JavaScript files started behaving strangely. Sometimes, the intellisense does not pop up but it can be displayed using keyboard shortcut. The worse problem is that it does not show local variables. The screenshot is here: http://i.imgur.com/RvyQVTm.jpg. The local variable abcde is not in the list. Here is a screenshot of the right behaviour: http://i.imgur.com/w5LM0JA.jpg. I encouter similar behaviour for object atributes when writing method (intellisense does not show attributes when writing this.).
The problem started happening on my laptop. I tried to solve it. I tried different solutions but with no luck. The reason is that the solutions I found were not for my specific problem. I even tried reinstalling Visual Studio.
Since I was not able to fix it on the laptop I tried installing Visual Studio on my desktop with fresh Windows 10 installation. I created new project and transfered files from laptop to the new project. Intellisense was working in the new project. I wrote some code, saved the project and turned the computer off.
When I returned to my project after few days I noticed that the intellisence was behaving the same way as on the laptop.
The most interresting thing is that the intellisense works in any new project I create.
I'm really desperate because I have already spent so much time trying to fix this issue. I will be glad for any help.
Since the time I posted this question I found out some ways how to minimize (maybe even fix) the issue:
I created new solution for the project and moved all files there by copying their contents.
I do not turn the computer off. I use hibernation with Visual Studio running. This might not be necessary because my project survived one Windows Update restart and several VS restarts due to plugin updates.
If you encounter the issue, check for syntax errors as gpersell suggests. Once, the intellisense got broken for me when I tried calling function with missing parentheses.
If you are sure there are no syntax errors, leave the computer for a while. This might sound stupid but it already helped me three times. I usually leave computer for 5 - 15 minutes with Visual Studio running with project open and when I come back the intellisense works again.
Do not delete contents of the \obj\Debug and \obj\Release folders. Use Visual Studio's Clean Project feature instead.
If nothing of the above helps, start again from the point 1.
I hope this helps someone.

How do I ensure my script file isn't cached when debugging a VS MVC website?

I came across a problem today where the only way for the web program I am developing showed the most recent copy of a modified script was to reboot the machine. It is a file bundled in the master layout page, in a script bundle. I tried CTRL-F5 and deleted all files (I think) in Internet Options of IE11 to ensure it wasn't using the cached copy, but that was not sufficient.
I then suspected the cause is related to the fact I am using the VS Development server in VS2010. I tried killing WebDev.WebServer40.exe, hypothesizing it was caching it there, but that was not it either. I made the test as basic as modifying the entire contents of the script file to be a single alert() message, which never appeared, until I rebooted the machine.
I've seen suggestions to add args to the file when referencing it, or rename it each build, but clearly that's not productive when running many iterations in new development. I am wondering if there's perhaps a Visual Studio or Internet Explorer option here that guarantees to load the un-cached file each build? Is IE also possibly caching this info in some other memory space I need to be aware of too? thanks
EDIT:
Ok, it turns out the root cause of the problem was a post-build step modifying the script files I was working on. Rebooting was therefore a coincidental fix. As always, blame the writer. :). However, I have seen this problem occur many times in the past, genuinely, and am still curious if there's browser settings available (with specifics) that ensure scripts (and CSS files) are never cached, in development.
Disable the browser cache. Accessed through the debugger or developer tools (usually F12).
Here are some examples:
Chrome
Firefox
IE11

Visual Studio JavaScript debugging extremely slow

I am having the strangest problem debugging JavaScript in Internet Explorer in Visual Studio.
If I set a breakpoint in JavaScript code and run the (ASP.NET MVC) project in debug mode, I hit the break point fine. But shortly after that, while on the breakpoint, pretty much my whole computer locks up for 10-30 seconds. During this time I can move the mouse pointer, but not interact with anything. If I click on things eventually the computer starts to beep.
After the 10-30 seconds is up everything is back to normal.
Debugging worked fine up until a couple of days ago. The same behavior is shown by different ASP.NET MVC projects.
I am running Internet Explorer 10 and Visual Studio 2012 on Windows 8 Enterprise 64 bit.
I have no third party antivirus (Only Windows Defender). I do not have intellitrace. I have only a single breakpoint, all others are deleted. I have tried deleting my .suo file.
My browser (ff) locks up on me when a script on a website is taking too long to run typically. It then throws a stop script prompt. The fact that you can replicate it across three computers makes sense if it's the same erroneous script causing the lock up. I doubt it'll matter if you try it on a win 7 box, win xp, but those are obvious tests if you're thinking sys configuration as a cause. Also, try setting your breakpoint earlier in the script to tell what/when is locking up.
On a different note, I've always debugged javascript in firefox with firebug with great success.
I had this same problem and it turned out it was Intellisense. Intellisense chokes on large Javascript files. The slowdowns would happen even when I wasn't doing something that required Intellisense.
I ended up splitting them out and referencing the other files with:
/// <reference path="/scripts/<other>.js" />
This allowed autocomplete to work across files and prevented the lockups.

Categories

Resources