Opening web.config file causes Visual Studio 2010 Ultimate to hang and crash - asp.net

Situation:
I installed Visual Studio 2012 on top of my previous Visual Studio 2010 Ultimate. I uninstalled VS2012 shortly thereafter along with all SQL 2012 database junk and yadda yadda. Everything in VS 2010 seems to be good, but when I try to open my web.config file VS hangs indefinitely.
Tried:
(1) Downloading and replacing the dsref80.dll that gets overridden by VS2012
(2) Uninstalled all VS extensions, including NuGet
(3) Created new website and web.config file. Problem persists
Question: Does anyone have any other ideas about what could cause the web.config file to cause VS2010 to hang and crash after clicking on it?

I figured it out. For some reason the web.config file was set to open with source code editor by default and not the HTML editor.
For anyone else who runs into this issue, the answer is simple.
Right-click the web.config file ---> Open with ----> Highlight HTML Editor ---> Set as Default.
Update (Dec, 2013): Although I was able to access the web.config file using the method mentioned above, I later realized that it was more of a Band-Aid than a solution. Using the html editor causes a lot of validation warnings and renders intelliSense useless. The correct solution is to run the repair option from the Visual Studio 2010 install DVD, that fixes everything.

Related

Visual Studio error "Object reference not set to an instance of an object" after install of ASP.NET and Web Tools 2015

After installing the ASP.NET and Web Tools 2015 (RC1 update 1) I get the following error within ASP.NET MVC 4 projects when opening *.cshtml files:
Object reference not set to instance of an object
I get the same error message even if I start a new ASP.NET MVC 4 project and try to open a *.cshtml file there.
I'm using Visual Studio 2015
Maybe this helps:
Delete the contents from the following folders:
C:\Users\%userprofile%\AppData\Local\Microsoft\VisualStudio
C:\Users\%userprofile%\AppData\Local\Microsoft\VSCommon
Sometimes, you need to go to:
[x64] C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
[x86] C:\Program Files\Microsoft Visual Studio 14.0\Common7\IDE
and run devenv /resetuserdata.
Expect, that all of your user settings such as Visual Studio layout, linked Microsoft account or start page might disappear.
Delete %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache and restart Visual Studio.
Alternatively, use the Clear MEF Component Cache extension.
For me,
I ended the process in Windows Task Manager: VsHub.exe.
Restarted Visual Studio.
After that, everything works like a charm again!
I solved it doing
run devenv /resetuserdata
in this path:
[x64] C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
I assume that in x86 it works in this path:
[x86] C:\Program Files\Microsoft Visual Studio 14.0\Common7\IDE
It's recommended to try any or all of the following:
Restart Visual Studio
Try Running As Administrator (right-click Visual Studio and choose "Run As Administrator")
Check for any updates for Visual Studio (download and install them if any are available)
Try opening a different solution / project
If problems persist, you might try the following options:
Restart your local machine
Attempt to reset Visual Studio to System Defaults (this can be done from the options within Visual Studio)
Attempt to repair your Visual Studio installation
In the hopes it might narrow things down/help someone, I did an investigatory approach. For me, I initially moved the folder at C:\Users\{user}\AppData\Local\Microsoft\VisualStudio to My Documents and allowed Visual Studio to re-create it by re-launching it. This removed the errors. So I moved everything back, one-by-one, and restarted Visual Studio each time until I discovered the culprits. These folders were fine to move back in:
1033 (overwrote the auto-generated copy with old)
Designer (was in my old copy, not initially re-created when I re-launched VS, copied it back in)
Extensions (overwrote the auto-generated copy with old)
ImageLibrary (overwrote the auto-generated copy with old)
Notifications (overwrote the auto-generated copy with old)
STemplate (was in my old copy, not initially re-created when I re-launched VS, copied it back in)
VTC (was in my old copy, not initially re-created when I re-launched VS, copied it back in)
These files were fine to move back in/overwrite the auto-generated ones:
ApplicationPrivateSettings (was in my old copy, not initially re-created when I re-launched VS)
ApplicationPrivateSettings.lock (overwrote the auto-generated copy with old)
vspdmc.lock (overwrote the auto-generated copy with old)
These files were fine to move back in. Each was in my old copy, and not initially re-created when I re-launched VS:
.NETFramework,Version=v4.0,Set=Framework,Hash=C958D412.dat
.NETFramework,Version=v4.0,Set=RecentAssemblies,Hash=0.dat
.NETFramework,Version=v4.5,Set=Extensions,Hash=75EAE334.dat
.NETFramework,Version=v4.5,Set=Extensions,Hash=497525A2.dat
.NETFramework,Version=v4.5,Set=Framework,Hash=5AE9A175.dat
.NETFramework,Version=v4.5.2,Set=Extensions,Hash=24CEEB0D.dat
.NETFramework,Version=v4.5.2,Set=Extensions,Hash=72AE305.dat
.NETFramework,Version=v4.5.2,Set=Extensions,Hash=ADF899D7.dat
.NETFramework,Version=v4.5.2,Set=Framework,Hash=D8E943A2.dat
These caused problems - delete these files and re-launch VS to allow it to re-create them:
ComponentModelCache - When I overwrote this folder's contents with my old ones (4 files: MS.VS.Default.cache, .catalogs, .err, .external), this gave me all of the errors I had gotten before about not being able to load packages when loading my project, and the "object reference not set to an instance of an object" error when trying to close VS.
devenv.exe.config - same as ComponentModelCache
.NETFramework,Version=v4.0,Set=Extensions,Hash=6D09DECC.dat - causes error output from the JavaScript Language Service, complaining of missing js files
.NETFramework,Version=v4.0,Set=Extensions,Hash=9951BC03.dat - causes error output from the JavaScript Language Service, complaining of missing js files
.NETFramework,Version=v4.5.2,Set=RecentAssemblies,Hash=0.dat - causes error output from the JavaScript Language Service, complaining of missing js files
These are the errors from those last .NETFramework files (which I do not get if I do not add them back in):
01:10:11.7550: Referenced file 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\JavaScript\References\libhelp.js' not found.
01:10:11.7550: Referenced file 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\JavaScript\References\sitetypesWeb.js' not found.
01:10:11.7550: Referenced file 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\JavaScript\References\domWeb.js' not found.
01:10:11.7550: Referenced file 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\JavaScript\References\underscorefilter.js' not found.
01:10:11.7550: Referenced file 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\JavaScript\References\showPlainComments.js' not found.
I might just need to re-install/repair the JavaScript Language Service plug-in, so it might be un-related. But definitely devenv.exe.config and ComponentModelCache need to go to correct the "object reference not set to an instance of an object" error.
For me, ASP.NET 5 is not yet required, I removed update, and then reinstalled ASP.NET 4.5. It's a bit tricky:
Removed from control panel "Microsoft ASP.NET 5 RC1 Update1". After that, you will no longer open ASP.NET MVC projects
Then I changed the installation of "Microsoft Visual Studio Professional 2015", clicked "Modify", and selected "Microsoft Web Developer Tools"
No longer follow the notification of update in Visual Studio 2015!!!
After trying the top answer, I found that you must also restart the computer. The error may be part of a git issue as well where restarting your computer will reset.
I was getting an exception every time I tried to create a "new" project.
My solution was:
Go menu Tools → Extensions and Updates
Check the "Updates" link... There was an update to Microsoft ASP.NET and Web Tools. Install it.
That fixed it for me.
In my case (not necessarily be the solution for you, but it may be helpful for someone), the solution was:
Go menu Tools → Extensions and Updates
Select the Online tab from the right panel
Search for the words web tools, and then select Microsoft ASP.NET and Web Tools and install it.
In my case, this was missing from my computer because of a lot of repairing operations for Visual Studio.
I was getting similar error in VS2017 while trying to publish my solution to Azure.
This algorithm helped me to resolve it:
Close VS2017
Open C:\Users{your user name}\AppData\Local\Microsoft\VisualStudio\ folder
Rename 15.0_08edcd83 folder
Start VS
Publish works fine!
Note that this will remove your Visual Studio's recent files / projects from it's history and also linking to MS account.
This method is slightly different from the Top answer. Here you don't have to delete other folders except renaming abovementioned one.
I was getting this exception every time I created a "new" project.
My solution was:
Go menu Tools ? Extensions and Updates
Not check the "Updates" link...search "asp.net". There was an
update to Microsoft ASP.NET and Web Tools. Get it as
AspNetWebFrameworksTools2015_KB3137909.exe and install it.
That fixed it for me.
Unfortunately, I ran into another exception:
"Exception has been thrown by the target of an invocation"
I disabled the FIPS setting Enabled DWORD value to zero.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy]
Enabled=dword:00000000 And All fixed.
Goto windows+R and type %temp% and hit enter. delete the temp folder and files and then try opening the same
I have been fighting with this during the whole weekend. But it's pretty easy to do it. What I did was to click on repair rather than uninstall. After repairing, I clicked on restart directly. After that, everything is working perfectly.
You should try this, may be it can work also for you!!!
Restarting Visual Studio did it for me. On the next run, it displayed a "Scanning new and updated MEF components ..." and then it executed normally.
It seems to be related to Windows update somehow, although I don't have proof.
Delete bin and obj folders in all projects of that solution.
Seems like those folders were having old files generated by some older version of visual studio, which are not compatible with new version of visual studio.
The solution to the issue when i had this earlier today was that there was an additional
set of tags bolted on the end of my Web.config. Once removed the functionality returned.
Problem:
My VS 2015 was throwing up error after I installed SSDT. Whenever I clicked on Tools >> Extensions and Update it was throwing "Object reference not set to an instance of an object" error. When I tried to open a solution it threw some provider not set correctly.
Solution:
After many hours of research trying out all the solutions previously mentioned by others didn't solve my problem. Every time the error popup was pointing to check the ActivityLog.xml. But I was ignoring it. After hours of frustration I decided to read the error carefully and looked into ActivitLog.xml and found that it was looking for "Could not load file or assembly 'System.Collections.Immutable, Version=1.1.37.0". So I just started searching for this assembly and stumbled upon this link https://sergeytihon.com/2015/12/01/how-to-restore-viual-studio-2015-after-update-1-dependency-dance/
and followed the steps there, which fixed my issue.
Went into %LOCALAPPDATA%/Local\Microsoft\VisualStudio\14.0\devenv.exe.config and searched for "System.Collections.Immutable" and change newVersion from 1.1.36.0 to 1.1.37.0
Final config should look like this
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="1.0.27.0-1.1.65535.65535" newVersion="1.1.37.0"/>
</dependentAssembly>

Visual Studio 2015 codelens issues when using Typescript

I'm using Visual Studio 2015 Enterprise RTM.
When creating an ASP.net 4.6 web application using the Web Api template, I noticed as soon as I add a TypeScript file, the codelens indicators stop working.
I tested this on a new installation, with no extra extensions installed, as well and tried other asp.net 4.6 templates.
When running in safe mode the problem doesn't occur.
Steps to reproduce:
Set the framework to 4.6
Create a web application by using the web api template.
Change authentication to no authentication
Open the webapiconfig.cs in App_Start
The codelens indicator on the register method should say: 1 reference
Add a typescript file called app.ts (doesn't really matter) in the scripts folder, tit may remain empty
The codelens indicator in the webapiconfig file should still say 1 reference
Close Visual Studio
Reopen Visual Studio and open the solution
Check the webapiconfig file, the codelens doesn't show references anymore or on any other file
Any idea on how to debug codelens or does anyone have this problem as well?
I work for the visual studio team that is responsible for codelens references indicators. I can confirm that this is indeed a bug in VS2015 where codelens references stop working when you add typescript files to your project or typescript projects to your solution :( Unfortunately, we missed this bug for RTM. We're currently actively investigating this bug. At the moment, I am not aware of any workarounds for this problem. I can post an update when we have more information to share on this bug.
I may have found a workaround that seems to do the trick for me:
So, I have a solution with multiple projects, only one of which has TypeScript files.
I just unloaded the project, cleaned + rebuilt (some restart to Visual Studio at this point may help + close all opened files), then loaded again, cleaned and rebuilt and now CodeLens shows my references (again, close all open files).
Note that until this bug is fixed, you may have to do this each time you open VS.
Hope this helps!
EDIT: If you only have a single project, then exclude the Scripts folder from the solution, clean, rebuilt, close Visual Studio then open it again. Now you should have the references back. Simply include the folder again.
Best of luck!
in my case references start working after uninstalling vssonar extension, vs2015ent

Is there any solution to Visual Studio 2013 not correctly generating .designer files for ASPX pages?

We have been encountering more and more frequently the Visual Studio error of being unable to generate the designer file in a web project. This problem has been occurring for a few months now, in several of our ASP.NET projects.
The errors occur when saving a file or when building the project, and are variations of errors like this:
Generation of the designer file for [filename] failed: Error HRESULT
E_FAIL has been returned from a call to a COM component.
Generation of the designer file for [filename] failed: Unspecified
error (Exception from HRESULT: 0x80004005 (E_FAIL))
Generation of the designer file for [filename] failed: An entry with
the same key already exists.
Generation of the designer file for [filename] failed: Value cannot
be null.
Sometimes, additional error messages are displayed for valid, previously-working code/markup; errors such as:
The name 'Eval' does not exist in the current context
This is with Visual Studio 2013 (Premium), with "Web Application Projects" type projects using the .NET 4.5 framework. Some of the projects were originally created in Visual Studio 2010 or Visual Studio 2012, but one of the projects was a new project created in Visual Studio 2013.
We have a few Visual Studio extensions installed, such as "Web Essentials 2013", but I have tried disabling all the installed Visual Studio extensions and the same designer file errors still occur. We do not have Resharper or CodeRush installed. We are also using a third-party components package (DevExpress) for ASP.NET. We are using IIS Express for the local development web server.
All available updates (including Update 1 for Visual Studio 2013) have been installed for Visual Studio, the operating system (Windows 8.1), .NET, Visual Studio extensions, and DevExpress.
I have searched StackOverflow and the web for this issue, and have found some suggestions but no solutions, and I have also seen that the issue has been reported to Microsoft several times, dating back some years.
Many indications are that the problem with generating designer files is caused by some invalid syntax (in an ASPX file), or multiple elements with the same ID in the same scope, or collisions in namespace or class names, etc. I have searched through our projects as best as I can for issues like this, but haven't found any.
I found the Redesigner project on Sourceforge (thanks very much to the author), and I tried using that to verify the designer files, but unfortunately it can't handle the DevExpress components (it reports that DevExpress elements are using invalid child tags when the tags are valid and correct for DevExpress).
I have also tried clearing the Visual Studio development cache on my workstation (that is, deleting everything from the folders "\Temp\IISExpress", "\Temp\Temporary ASP.NET Files", and "\Microsoft\WebsiteCache" folders in the %localappdata% folder, rebooting and restarting Visual Studio.
I also found a website that explained how to turn on additional logging for Visual Studio to help with tracking down designer file generation issues. For Visual Studio 2013, this requires adding a key HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\WebApplicationProjects\Debug and then adding values under that key for "Enabled" (set to 1), "LogFieldGeneratorFailures" (set to 1), and "LogFile" (set to a path and filename that you have permission to write to).
When I added this key, Visual Studio 2013 did write to the debug log file, but it only included error messages similar to the error messages above plus a small stack trace plus the entire content of the ASPX file for which the designer file could not be generated (with no apparent indication of where in the ASPX page there might be an error or invalid syntax).
I think I have tried essentially all suggested approaches in this topic:
How do you force Visual Studio to regenerate the .designer files for aspx/ascx files?
None of these have worked for me. The "Convert to Web Application" option for the ASPX file is not available for me in Visual Studio 2013 in these projects.
Does anyone have any suggestions for potential causes or fixes for this desinger file issue or for any other troubleshooting approaches?
The latest that we have discovered with this issue is that it's related to the Source Control option in Visual Studio to "Get everything when a solution or project is opened".
Having this option UNCHECKED seems to have resolved the problems for our team so far (for the past few days).
There is also this issue posted at Microsoft Connect: http://connect.microsoft.com/VisualStudio/feedback/details/760443/visual-studio-2012-ide-loses-intellisense-and-reference-resolution
The comments at the link above suggest that the bug is caused by asynchronous retrieval of files from source control or the asynchronous solution load when Visual Studio is opened. The choices suggested for fixing the problem are to either turn off the asynchronous solution load or to disable the "get everything on open" option.
There are also suggestions that deleting the .suo (Solution User Options) file in the project directory resolves the problem, but this seems to be only temporary.
The only solution that I've found to work is to delete the Visual Studio cache # C:\Users\<>\AppData\Local\Microsoft\VisualStudio and then running Visual Studio with the /resetuserdata switch. It's a horrible solution that deletes all of your local settings, and resets Visual Studio.
(You can try exporting and importing your settings before and after the surgery.)
Links
(Delete the 2013 cache)
http://blogs.msdn.com/b/willy-peter_schaub/archive/2010/09/15/if-you-have-problems-with-tfs-or-visual-studio-flush-the-user-cache-or-not.aspx
(Fixing the error in 2010, which is slightly different)http://rathodkrunal.blogspot.com/2011/11/visual-studio-2010-error-hresult-efail.html
It's also an open item on connect, if you want to bug MS into fixing it.
https://connect.microsoft.com/VisualStudio/feedback/details/799832/constant-call-to-com-component-fails#tabs
Ran into a very similar issue assisting a colleague. The project had been converted from 2010 to 2013 and was working for most developers. To "resolve" this, we had him close the solution, then delete all of the source control files at the solution level, (vsssc). Once reopening the solution, all was fine.
I've had this issue constantly in different dev environments for the last while. I managed to solve it in one case without using the cache clearing technique by launching component services->DCOM Config. When I did this I was prompted to register a missing key. (didn't quite catch it but something related to EventManagement). Clicked OK and lauched visual studio...hey presto...back in business. Hopefully this advice might catch a few cases out there.

Visual Studio 2012 Error

I use Visual Studio 2012 on a Windows 8 PC. I had no problems when installing VS2012.
When I'm working on a ASP.NET c# project I usually use the option "See in the explorer" instead debug the project. This gives me the ability to change code behind.
Sometimes after build and press F5 to reload the page I get some errors. This doesn't happend always, but very often.
The errors are: CS2021, CVT1100, CS1566...
"Can't find file 'C:\Users\UserName\AppData\Local\Temp\Temporary ASP.NET Files\root\617be439\61539075\App_GlobalResources.iuxkzxdi.0.cs'"
Always the "C:\Users\UserName\AppData\Local\Temp\Temporary ASP.NET Files\root" is the problem. Sometimes it says can't find file others it says access denied.
Visual Studio works but is horrible to keep pressing F5 until the error goes away.
Can anyone help me?
Run VS2012 as Administrator. Local account by default have restriction accessing the build/temporary locations and will throw such errors. You'll have similar problems when trying to publish websites.
Therefore, It is easier to set VS 2012 once, and check the box in properties to "Run program as administrator" to allow it run always as "Administrator".

breakpoints in code behind not hit

common problem I guess, but no solution has worked so far:
my breakpoints (asp.net 2.0) get hit nicely in "backend" assemblies but not
in the code behind.
i can even see the
<% Response.CacheControl="no-cache"; %> line being hit in my asp.net master file
but still not the code behind.
I'm using VS 2005, windows 7 32 bit.
Any idea what else could I check?
If your code file is newer than the compiled version that is being run against (on the web server, whether it be IIS or the dev server), breakpoints will not be hit (the red circles will be hollow).
Try doing a clean / rebuild and see if that works.
EDIT:
I just noticed something in your last comment; you said you are attaching to the asp.net process. To which process are you attaching? It should be w3wp.exe.
My problem ended up being that I'd created a new configuration for the project, but that none of the debug properties on the project were set for it. So this is what I had to do:
Right click the web project and select Properties.
Go to the Build tab.
Click Advanced.
In the dialog, ensure that in the Output section, Debug Info is NOT set to none.
I'm guess there is a problem in loading the symbols for the page, and hence the breakpoint is not hitting,
try this
1 - While debugging in Visual Studio, click on Debug > Windows > Modules. The IDE will dock a Modules window, showing all the modules that have been loaded for your project.
2 - Look for your project's DLL, and check the Symbol Status for it.
3 - If it says Symbols Loaded, then you're golden. If it says something like Cannot find or open the PDB file, right-click on your module, select Load Symbols, and browse to the path of your PDB.
4 - I've found that it's sometimes necessary to
stop the debugger
close the IDE
close the hosting application
nuke the obj and bin folders
restart the IDE
rebuild the project
go through the Modules window again
Once you browse to the location of your PDB file, the Symbol Status should change to Symbols Loaded, and you should now be able to set and catch a breakpoint at your line in code.
hope it helps !
Answer source
Ugh. In my case I had mapped the right folder in IIS, but the application was set on IIS Express.
So the correct assemblies where loaded when I went to the URL, but the application was attached to a IIS Express version that never got any hits.
In my case I updated my repo from Git and the Project changed from Local IIS to IIS Express (Project > Properties > Web tab). This somehow messed up my configuration and I was not able to debug.
My problem was fixed by setting it to "Startup Project"
Solution Explorer -> Right Click on the project -> Set as StartUp Project
or
Menu bar -> PROJECT or WEBSITE -> Set as StartUp Project
Just to help others who come across this question, I too had this issue where none of my breakpoints where being hit.
It turned out that the project was originally created in Visual Studio 2015. I have 2008, 2010, 2015, 2017, 2019 installed. I accidentally opened it in 2017 and then this issue occurred. Opened it back up in 2015 and back to normal.

Resources