Viewing the updated HTML in ie6 - javascript

I am working with ie6 (unfortunately) and i am having a javascript error. Its wondrous error message gives me a line in the html source, but unfortunately the javascript that does run changes the code for the page(dramatically). So the error that its pointing me to is a closing div tag, not actual code.
Is there a way to view the updated code for the page so I can at least know where my code is breaking?
I should also point out what im developing in.
I am developing a sharepoint 2007 solution for an winxp and ie6 user base. I am working via remote desktop on a sandbox winserver 2008 r2 and can access the site from my terminal. Now, unfortunately in my sandbox server i have ie 8 in which my code works. So im stuck on ideas. If anyone knows how to view the updated source on the page, i would be very grateful.
Thanks.
Edit. I should also mention i dont have admin access on my terminal. So i cant install visual studio. It would take a couple weeks for an issue ticket for temp admin access to install it, and this is sort of important.

If you can't install anything and the error console information isn't meaningful, then about all you can do is start modifying your code until you can find which section is causing the error. The kinds of modifications you can do are as follows:
Comment out a chunk of code in a way that won't cause more errors. If the error goes away, then you know it's in that block of code or something that code calls. Put that block back in and then comment out a piece of it and so on until you narrow down where the problem is.
Start inserting alert("1"), alert("2") prompts into your code with the goal of identifying which alert the error comes before and after until you've eventually tracked down where it is. When you rule out an area, remove the alerts to make it feasible to still run the app.
On a more modern computer (e.g. Vista/Win7) go to Microsoft's site and download both Microsoft Virtual PC and the Windows image for XP with IE6. You can then actually install things into the VM and do real IE6 debugging or at least see what the actual error is.
Find a computer with XP/IE6 on it that you can install real debugging tools on.
Build your own dummy little debug window using a textarea and a couple functions that append text to it. Put that into your browser page and start sprinkling mydebug("Entering function foo") statements throughout your code so you can narrow down which statements occur before and after the error and eventually find the error. This is how I've done some IE6 debugging when it was't worth the trouble of setting up a full-blown debug environment for IE6. This works much better than alerts for some types of problems because it doesn't interrupt the flow of the app or require lots of user intervention and you can scroll back through the history.

If you are using visual studio you can use it to debug js errors in ie.
Go to the Advanced Internet settings in ie and make sure that the two
Disable script debugging settings are turned off (so that script debugging is enabled)
and that the setting
display a notification on every script error is enabled.
If you don't have visual studio installed you can download and install microsofts script debugger (it's free just google it) and use that, tho it is not as easy to work with and won't give you as much useful information

Related

Unable to debug browser JavaScript with Visual Studio 2017 or 2019

I am trying to debug a Web app with some ASP.NET (vbhtml) components and some more regular HTML5 bits. It was built several years ago and makes extensive use of Knockout. Some of these parts are broken and I am trying to debug them.
The project includes an API (WebAPI 2) and some other stuff. It is not straightforward to separate out the HTML5 parts and debug them using VSCode, so I think I am stuck with using Visual Studio.
For a tantalizing few minutes two days ago I was able to set breakpoints, step through the Javascript code and find one problem. I am not sure what I did right. Since then I have been unable to do any debugging of the Javascript components. I have tried using Visual Studio 2017 and 2019.
I ran debugging with Chrome selected and script debugging enabled. As soon as the browser launched, the breakpoint got a yellow flag at its left hand end which showed a message: The breakpoint will not currently be hit. Breakpoint set but not yet bound.
The browser ran normally but the breakpoint was not hit. When the Inspect window was open I could see some stuff heppening but nothing relevant.
I set up a new "Browse With" entry in Visual Studio. I selected chrome.exe and added --remote-debugging-port=9222 in the Arguments field. Saved it and started debugging. After the browser opened, I got pop-up error message: Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:51772).
Every time this happens I get a different port number at the end. When I click OK, debugging stops and the browser window closes. I have made absolutely sure that Chrome is closed before starting debugging, to the extent of running a batch file that kills all Chrome processes.
After more searching I selected the Chrome debugging configuration and then Debug|Start Without Debugging. Chrome started OK. I then selected Attach to Process and selected the process. It all looked good but the breakpoint went inactive again with the "breakpoint will not currently be hit" message.
I have tried adding "debugger;" entries to the code. VS 2019 complains about them and they have no effect.
If I try debugging with IE11 and got similar results. Sometimes I got an error saying that another debugger was already connected although I had previously killed Chrome.
I am at a loss. Any clues would much appreciated.
Rob
The problem was definitely in the bundle configuration. In my case it is a file called BundleConfig.vb. It appears to bundle up JavaScript and css files to enable faster loading of the site rather than loading each of the files as a discrete HTTP request.
My file starts like this:
Imports System.Web.Optimization
Public Module BundleConfig
' For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
Public Sub RegisterBundles(ByVal bundles As BundleCollection)
bundles.Add(New ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-3.4.1.min.js",
"~/Scripts/jquery-ui-1.12.1.js"))
and ends like this:
BundleTable.EnableOptimizations = False 'Commented out 190601 to debug scripts
'BundleTable.EnableOptimizations = True
End Sub
End Module
If EnableOptimization is True you will not be able to debug any of the JavaScript with either Visual Studio or the debug tools in Chrome or IE. Comment it out and debugging becomes possible.

Visual Studio 2013 can't debug javascript in cshtml

I have an ASP.NET Web Application created with Visual Studio 2013. I am attempting to debug JavaScript in a CSHTML file. However, whenever I launch the webpage, any breakpoint turns into a red circle arrow and states, "The breakpoint will not currently be hit. No executable code of the debugger's target code type is associated with this line. Possible causes include: conditional compiliation, compilier optimizations, or the target architecture of this line is not supported by the current debugger code type."
Recently, the project was switched over to support MVC and RAZR, neither of which I know well, and this is exactly when this issue began. However, searching those have yielded results that don't fix my issue.
Web.config:
<compilation debug="true"...>
I know I can debug JavaScript with Firebug or some other browser tool, but I would much rather stick with Visual Studio's debug as that is what I am used to.
So, apparently this is a "known issue" that will be fixed as soon as possible. A temporary work around that works for "some" people is making sure any Javascript is in a separate file.
It is caused by having RAZR and Javascript in the same file and Visual Studio 2013 not being able to handle debugging in that instance.
I don't know what your particular problem is, but if you want to force a debug breakpoint to always happen, add debugger; to the line that you want it to stop on, and it will stop. This is regardless of where the JS is located (in a .js file, .html, cshtml, etc.)
Here is a blog post about it:
http://sumitmaitra.wordpress.com/2013/12/11/quickbytes-visual-studio-2013-and-javascript-debugging/
I also agree that JS should go in a .js file (which I've never had a problem adding a break point in a .js file), but for quick prototyping, this is a solution you can use.
If that still doesn't work, you can always you the F12 tools
The only browser that allows debugging a javascript file from Visual Studio is Internet Explorer. (this is what I found out after testing my application on different browsers)
I put my javascript in a separate file and debug with IE otherwise it will not work.
For some reason chrome doesnt allow you to step into the javascript.
One additional thing to check. If you have a App_Start|BundleConfig.cs (which came with MVC 4 - or maybe 3), set BundleTable.EnableOptimizations to false (or, like I did, wrap it in an #if !DEBUG #endif and take the default setting).
I tried and failed to use Chrome and then IE and ended up using the Firebug addon in Firefox, and I was able to debug and set breakpoints in my JS with no problems (in an MVC6 app on Visual Studio 2015 where this is apparently still an issue?!)...
FYI - When I tried to debug my JS in Chrome using the F12 Developer Tools, it told me it was not an option as the Debugger was already attached to another process...
For people coming here in 2017, I want to share that I had this same issue with VS2017 Enterprise RC, and with VS 2015 Community with any browser but Internet Explorer. Using IE did the trick for me.
Also, in VS2017, I had to add a debugger statement to get VS start looking at debug points.
Finally, I'd like to ask at least a comment from people voting down.

The breakpoint will not currently be hit. No symbols have been loaded

I am struggling with breakPoint issue in VS 2012 for more than hours. I am from eclipse background, there I never heard about such issues.
Problem :
The breakpoint will not currently be hit. No symbols have been loaded
for this document.
I have placed the break point in click action of Jquery.
I found the issue using the IE script debugging., The file loaded was old file., i.e I have modified a lot, but I can see no changes in the one which is loaded in IE. How to fix the bug
What I have Tried :
I know this question is duplicate, but being a newbie to VS and C#., I could not understand the older answers. For example, in this answer, he told to choose Debug -> Windows -> Modules. But I doesn't have Modules under windows in VS 2012. Also even though I read, I could not understand the explanation.
Also I am quite new to term Assemblies and PDB. Though, I located PDB files as he said. But how to open the .pdb file?
Need :
Could anyone explain me the same answer in easier term (with more explanation).
I found this out by accident with my VS2012 and ASP.NET MVC, maybe it can help somebody. I noticed that breakpoints in javascript that's inline in the *.cshtml file like this won't get hit (note that this file is a cshtml file):
But breakpoints in external *.js files will get hit:
Try to add debugger; key word before $.getJSON
Also make sure if you use IE to un-check the disable script debugging
Internet Options> Advanced tab> Under Browsing.
As I think this issue is related to Javascript debugging not C#
This results for me:
In your web application make sure Silverlight and ASP.NET debugger are enabled.
How to get there?
=> Right click on the Web Application => Properties => Web tab. Under Debuggers section make sure Silverlight and ASP.NET are enabled.
Running Visual Studio 2013 or Visual Studio 2015 RC, I've found that to get a breakpoint to work in a .js file I need two things to be true:
I need to start Visual Studio by right-clicking the VS shortcut and select "Run as administrator". (If right-clicking on the Taskbar icon, select the application shortcut icon from the pop-up menu and right-click on that to get a context menu that includes "Run as administrator".)
I need to set Internet Explorer as the default browser that will be opened for the web debugging session. If I choose Chrome or Firefox, the breakpoint doesn't work for me.
After opening and closing VS, rebooting the PC with all with no chance, this workaround worked for me in VS 2012 ( Ver 11.0.50727.1 RTMREL ):
In Project Property Pages, under Start Options, in Debugger section, only ASP.NET was enabled. As soon as I enabled Native Code and SQL Server, that red circle with plus sign inside, enabled again.
No idea why this worked! No active connection in Server Explorer nor using any native code in the project!
I had the same problem. You can use VS2017 to debug JS code this way.
When you set VS to launch the browser (Chrome in my case), it opens a new Chrome window. I was trying to debug the specific code (different URL from the window that opened) in a new tab. So I had the 'The breakpoint will not currently be hit. Breakpoint set but not yet bound' in VS.
I found out that if I opened the new URL in the original tab it suddenly worked. Seems that VS is tied to that particular tab.
Hope this helps.
These are the particulars of my situation: VS 2017 - Mainly C# code with some embedded HTML/JS which I needed to debug, Chrome (Version 68.0.3440), Windows 10
As this is Javascript code, so you need to use a javascript debugger. Generally internet browsers come with a debugger/inspector menu, which allows you to inspect/debug your javascript easily. Such debuggers come with a lot of useful features such as HTTP request/response inspection, browser session/local storage, etc.
Actually there is "Modules" option, but it's enabled only when you are in debug mode.
You can just press Ctrl+D,M combination when you're in debug.
In few words, PDB is a file that contains all debug information about your assebmly, you can not debug an assembly without this file. Assembly is a file that contains precompiled code for exetuion via CLR.
Could you provide a bit more information about your problem. What kind of application you are trying to debug for example?
Also, if you have located you pdb files made EXACTLY for your assembly, you can load it by right-clicking your assembly in modules window and selecting Load Symbols From > Symbol Path
Try deleting all breakpoints and restarting debugging in Visual Studio.

Breakpoint not getting hit due to symbols not been loaded

I am trying to debug an issue with my JavaScript based Windows 8 Store app related to search activation. I have re-build and deployed again on my machine but for some reason the breakpoint in the activated method is not getting hit. It shows me message that "The breakpoint will not currently get hit. No symbols have been loaded for this document". Any idea what I may be doing wrong here?
My guess is that you're set to debug managed code and not script. Sometimes also being set to debug both managed and script will also cause this behavior.
In your HTML project's properties, navigate to the Debugging section and select Script Only. Please note that this will disable Managed code debugging, so you have to choose between debugging managed libraries or Scripts at a time. The following screenshot shows this setting.
Image/parts of the steps borrowed from this post: http://www.silverlightrecipes.com/2012/04/windows-8-quick-tip-debugging-managed.html

Sitecore doing random things

I have a feeling that our Sitecore install is messed up with the configuration but I can't point out where. Things happen at random in the Sitecore client. For example -
Clicks in the Sitecore client do nothing.
If I log out say after opening up Log Viewer and then log back in, I only see the log viewer and no other options.
Clicking on a link would log me out.
If I am logged in and another admin tries to log in with his/her credentials, sometimes they see my credentials.
IE 8 continuously throws 'scWin' related javascript errors.
The first 4 are consistent across firefox, chrome and IE. The last one is totally an IE occurrence.
An IIS reset fixes these issues but then these occurrences start happening again pretty quickly.
I've looked at log files but I don't see anything there. What else can I do here?
This sounds really strange. Are you sure you are not infected with some kind of malware or some virus?
Does it occur on every pc that is working with this solution?
You could try to remove the Sitecore files and copy fresh files from the install zip to see if that resolves the issue.
This does sound rather strange... First thing I would do is make sure you followed the IE setup guide exactly, to make sure it's not your browser causing problem. Javascript is definitely enabled, yes? The fact that it happens in Firefox also though means this probably isn't the real issue. Martijn might be on to something... have you tried using another machine entirely to access the site?
It turned out to be .NET caching - section - was turned on and was causing all sorts of issues. We removed this and it all worked.

Categories