Browser Link JavaScript breaks on debugging WebForms project - Expected Identifier - visual-studio

Upon debugging an ASP.NET WebForms project, I'm shown an error dialog in Visual Studio 2013.
The Browser Link feature includes a handful of pre-generated or runtime-generated JavaScript.
JavaScript critical error at line xyz column abc in http://local.host/foo/browserLink\n\nSCRIPT1010:
Expected Identifier
This is on setting the line label.for = id;
How can I avoid this error?
Visual Studio 2013 Ultimate
IE 11
Windows 8.1 Pro

You'll find the problem is the new Browser link feature.
You can disable it, it solved my issue with IE7 and below when debugging.

for is a reserved word. You either have to choose another name or do label["for"] = id;
IE doesn't accept reserved javascript words.

Adding the entry below to web.config resolved the issue for me.
<appSettings>
<add key ="vs:EnableBrowserLink" value="false"/>
</appSettings>

Related

Can't start/debug application in VS2013 anymore

Since today I can't debug any applications anymore.
If I want to start the debug session, I get the error message
error while trying to run application: invalid pointer
It doesn't depends on the project, this behaviour appears in every project/solution.
What i've already tried:
Reset VS settings
repair Visual Studio
complete reinstall of visual studio
Changed Build Platform to x86/x64
Enabled native code debugging
If you press Ctrl-F5 to run the application, you won't get the error and the application will start, but you can't do debug, so this isn't a real solution.
The only way to solve the problem is to update Visual Studio: I had the same problem (WPF application), which was solved by the Microsoft Visual Studio 2013 Update 4.
If you're running VS 2013 and get an error that's pointing to the body tag, try adding this to the web.config under
<appSettings>
<add key="PageInspector:ServerCodeMappingSupport" value="Disabled" />
That key disables browser link which currently isn't playing nice.

Visual Studio 2013 produces garbled/corrupted/wrong-encoded html

I have a MVC4 Web project with Razor, which works fine in VS2012.
In VS2013, after clean-rebuild, the same web project produce html with encoding issues. its looks like this. Lots of ��� (question mark characters in a dark diamond)
I am pretty sure its VS2013 that is the cause - I have tried re-installing IIS, recreating the websites, disabling gzip compression, disabling caching, deleting temporary compiled files etc etc etc... I am using VS2013 Pro Edition in Windows 8.1.
If I switch back to VS2012 and clean-rebuild the response is back to normal.
I have also tried the <globalization> element in project, and meta Content-Type and same with http headers, various combinations of content type values etc, to fix encoding in VS2013 - all to no effect.
Any solutions?
Could be the Browser Link feature in VS 2013. Look for this in your toolbar:
Uncheck Enable Browser Link and reload the web page (rebuild shouldn't be necessary).
I figured this out noticing a bunch of requests like http://localhost:64667/613318d74fb54ab5bed269c36eb39fde/arterySignalR/connect... in Fiddler that I had never seen before. Also, using the Raw tab of the inspector in Fiddler showed lots of random unprintable bytes being injected into the HTML of my web pages.
Browser Link can also be disabled via web.config, as follows:
<configuration>
<appSettings>
<add key="vs:EnableBrowserLink" value="false" />
</appSettings>
</configuration>

VS2013 - Operation Could Not Be Completed

After installing Visual Studio 2013 and playing around with some of the new features, I noticed I'm unable to open a cshtml file in one of my MVC projects. If I try opening it in the default html editor, I'm receiving the following error
The operation could not be completed
Opening the file in another editor, IE: HTML (Webforms) Editor, opens the file without any issue. So it seems to be an issue with the default Html Editor.
I've followed various suggestions for how to combat this problem from previous versions of VS. If I delete all the solution's ".suo" files, and restart Visual Studio, the error changes to:
Object reference not set to an instance of an object
Once Visual Studio creates a new ".suo" file, the error message reverts back to the previous one.
I've tried doing a repair install on VS2013, however I'm still running into the same issues. Also, running VS in Safe-Mode did not work either. I tried creating a new MVC project, which failed during creation. With any of these errors, the windows event log does not contain any messages.
Has anyone else had this problem?
Just found your question here because it happened to me as well. Here's what I did and hopefully it will fix / help find the problem.
Deleted all .suo
Terminate IIS Express
Close VS2013 and re-open
Open your project and try to start it (F5)
You probably have an error on your web.config file. For me it was an <appSettings> being there twice.
Fixed the web.config file, save and boom, error is gone.
Hope it will also fix your situation.
Found a working solution here (tested with VS2015 Update 1):
https://github.com/aspnet/Tooling/issues/276#issuecomment-166650817
Close VS
Delete the content of %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache
Open VS
I just figured it out. In my web.config, I had the following in my
<appSettings>
<add key="webpages:Version" value="2.0.?.?" />
</appSettings>
Changing this the value to "3.0.0.0" resolved the issue. I never had a problem with this on VS2010 or VS2012. It seems there is something in the IDE that is not handling this gracefully.
That worked for me for VS 2015 (command prompt as Admin):
cd C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
devenv.exe /resetuserdata
Like most people here have mentioned, review your web.config file for duplicates. I was in a rush, just copied and pasted appSettings from another solutions without noticing the section existed already in the existing document. Then issue this thread relates to started to surface. I went back and consolidated the appSettings, saved, and the issue ceased to exist.
For me this error was resolved by setting the VS 2013 shortcut to "run as administrator".
Check for errors in your web.config file:
duplicate keys (app settings)
tags not closed or used multiple times
...
It is due to IIS Express not running from Visual Studio when you try to debug the aspx page.
Quick and dirty fix is to right click the your project and choose "Use Visual Studio Development Server" and then again right click and choose back to "Use IIS Express" will fix this problem. This way I will care about all the changes required in configuration file.
I also got this problem after using some Nuget package. The problem was a duplicate of appSettings. I merged them all and it worked.
There is also this thread that an MS employee has answered with possible cause:
This is a bug in the debugger. There is a race condition that happens when all of the following are true:
Script debugging is enabled in IE User is debugging IE and another process
The other process stops (hits breakpoint, step operation completes, stops at an exception, etc) at a moment when IE is not running script code
IE starts running script code at roughly the same moment that the user hits F10/F5 in Visual Studio.
The most likely
reason for this to happen is that the code from 'setTimeout' is run,
but I am not a JScript expert, so I am sure there are other possible
reasons as well.
and these workarounds:
If you hit this problem, I believe you could detach the debugger and then re-attach.
-or-
This problem happens when debugging ASP.NET and when script debugging is enabled in IE. If you disable script debugging in IE, or
toggle it on and off when switching between debugger server-side and
client-side problems, you would be able to work around the issue.
-or-
If your web application is using setTimeout, you may be able to avoid or at least reduce the problem by doing something to ensure that
script runs less often. This could mean increasing the timeout value,
or this could mean adding conditions around when setTimeout is used.
I had error in my web.config file, there was two spaces before <xml> tag. after removing it stopped showing this error.
I had the same error in VS 2015 running on Win 10. Fortunately fixed simply with a reboot. On restart it appears windows applied some updates in the previous session which broke VS somehow.
I got this error in Visual Studio 2015 but only after I installed ASP.NET 5 RC 1.
Installing Visual Studio 2015 Update 1 fixed the problem for me.
What solved my issue is this :
Type %LOCALAPPDATA% in Windows Explorer and go to Microsoft\XX.0 your version of Visual Studio then delete the folder ComponentModelCache
Restart VS and it worked like a charm!
This is due to an update made to GitHub which is reported in their forum
I was asked by a colleague to look at this problem. I tried all the proposed solutions and nothing worked. Eventually I found that they had done a project Update from svn and they had a conflict and ignored it. In one of the config files I found the conflict marked ".yours". I corrected this and all now loads without error.
In my case, the problem was due to my web.config's app settings include pointing to a file that doesn't exist:
<appSettings configSource="App_Config\MISSPELT-FILENAME.config" />

Visual Studio 2012 autocomplete in HTML files not working

Can someone else confirm that autocomplete HTML tags is not working in Visual Studio 2012?
You know, type <a> and VS2010 automatically inserts </a>. That doesn't seem to work in VS2012 at all - I tried this on 3 different machines (Windows 7, Windows 8 and Windows Server 2008), two of them had previously installed VS2010 but one was completely clean (fresh VS2012 install on Windows 8 Professional).
If someone can confirm, do you maybe have a solution for it? This is such a pain, it renders VS2012 broken for me.
I opened a Connect case here if you wish to vote on it:
http://connect.microsoft.com/VisualStudio/feedback/details/758970/auto-insert-closing-tag-in-html-files-razor-plain-html5-web-forms-does-not-work-in-vs2012-rtm
and another one by someone else:
http://connect.microsoft.com/VisualStudio/feedback/details/759416/auto-insert-close-tag-fails
Works for me.
Can you check in your VS options that Text Editor > HTML > Formatting > Auto insert close tag is on.
If it is, check specific settings of the a tag by clicking the Tag Specific Options button and selecting the Client HTML Tags > a option.
I worked with MS's Visual Studio 2012 team to figure out what was going on and it happens to be a locale related issue. It is actually a confirmed bug.
See this blog article for more information:
http://blogs.msdn.com/b/webdev/archive/2012/09/26/workaround-for-html-closing-tag-problem.aspx
I encountered the same disturbing action on the part of Visual Studio 2008; only it wasn't the editor.
The problem was simply an existing closing p tag quite a bit further down in the HTML source. Whenever I opened a new p tag, the HTML editor "saw" the existing closing tag and so did not generate one.
I found the problem by using the W3C Markup Validation Service (http://validator.w3.org/).
Hope that helps.

Visual studio 2010 ajax control toolkit tab container

We just upgraded to visual studio 2010 RC1 and all of a sudden our controls inside tabcontainer disappeared from the designer file.
Actually, it all seemed good in the beginning, the project compiled nicely, but as soon as we did any change in the markup of a page and build the code for the controls inside the tabcontainer disappeared and we got errormessages like so
"Error 3 The name 'ddlPeriodicityStartInMonth' does not exist in the current context "
Does anyone know if any changes are made to tabcontainer to visual studio 2010 or if this just is a bug?
Thanks in advance.
Found this one also.
Workaround: Missing Declarations for Controls in Designer File
I had the same problem.
Check out the following link:
Microsoft Connect - Bug in generating the designer.cs file in VS2010
Hope it helps.

Resources