Visual Studio freezes up continually when I'm editing master pages or aspx files. Here's what I've tried that have not helped:
restarting VS
only working with few files open at a time
Disabled all addins (resharper etc.)
deleted .suo and .user files
changed default editor
from Web Form Editor and Master Page
Editor to HTML Editor
installed SP1
I don't have tons of files - 3 Master pages and maybe 30 aspx files. It is a asp.net mvc project. All I have to do to get VS to freeze is type a little text or even just paste. The freezing lasts a good 5-10 seconds. My machine has 4GB of RAM and fast disks.
Could it have anything to do with asp.net mvc? Would the amount and size of other projects in the solution affect the editor?
I Solved this problem by uninstalling 'Microsoft Visual Studio Web Authoring Component' from my machine. It can be uninstalled from 'Add/Remove Programs' option in Control Panel. What a nightmare!
Now everything works just like its supposed to. I'm surprised Microsoft couldn't figure out what the problem and solution is. How much do they spend on R&D and Q/A again?????
Hope this helps others.
I had a similar issue and found an article about the problem, rather than reinstall Office to check, I simply renamed the setup.exe to setup.exe.old and that resolved it.
I finally figured out what the problem was with mine. I had a protocol relative script reference in my masterpage that was reeking havick on my editor. Hopefully a bug microsoft will fix soon.
Here is what I had:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
type="text/javascript"></script>
What I had to do to fix it:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
type="text/javascript"></script>
Hope that helps someone
I'm not sure about that, but I guess that if you're having a lot of (probably huge) projects in the solution, this would definitely slow down VS for it parses the code to give you an up-to-date intellisence menu ...
Master pages are a little slow anyway, especially that VS is not that fast on rendering the HTML elements, not to mention Master pages.
It can also happen if you have markup problems.
For instance, if you have a Label control and add something like Text="<%# TranslateLabel("lblSearch") %>" the page will freeze even in source mode when attempting to save it. The correct sintax should be Text='<%# TranslateLabel("lblSearch") %>'. I know it is not your problem, but maybe it's useful for somebody else...
With VS2005 I found the problem to be with a link to a javascript file (that was in a master page) that I entered as
<script src="../../js/file.js" type="text/javascript" />
when I change this to just <script src="/js/file.js" ... >
the problem went away.
NOTE while this "bad link" was in the master page, VS2005 hung even when I did not have the masterpage as an open document. Basically as soon as I tried to edit anything (or even build the app) VS hung. I had to close VS, change the offending file in note pad and open VS again. Then all was good.
The very odd thing was I added this link to the file last night and VS was still behaving ok, it was not until this morning after a restart that the file caused the problem.
I Hope this helps someone
Derek
I have been having this problem off and on for a few weeks. I finally resolved it today. The source (nice pun) of the problem was source control. I am currently using Visual Source Safe 2005 (I know, I'm dumping it soon), but I think it could be an issue with any source control package.
I first suspected VSS when I was able to edit ASPX pages in the design view without issue using a machine that was not connected to VSS. If I removed source control from the project, everything worked fine.
I then discovered that somehow my VSS connection settings got changed from using a folder connection to a web connection. I'm not sure how this could have happened since I am the only one that uses VSS and I certainly didn't change it. Anyway, I reset it back and everything began to work normally again.
rename worked for me i.e. changed setup.exe to setiup.exe.old
C:\Program Files (x86)\Common Files\microsoft shared\
OFFICE12\Office Setup Controller\Setup.exe
wish i'd found this article first - it has taken me many man hours
thx -j
I got the sampe problem with Visual Studio 2008 SP1. And yeah it was a masterpage as well.
The solution what I found is to restart Visual Studio 2008 and use the source mode of ASPX file :)
I guess the problem here is a masterpage.
I had the same problem when I removed Office 2007 to install Office 2010 beta. I have installed Office 2010 64 bits on Windows 7
I used Robert MacLean's solution, and it works for me, I just renamed the file.
I am not sure if this is going to help anybody but after trying all the answers here to no avail I deleted a huge block of commented code on my ASPX page and the behavior went away. I am not really sure why a large commented block of code would cause VS to freeze up after every edit action but that seems to be what happened.
I had a similar problem where Visual Studio would just hang indefinitely when opening a master page file. I solved it by opening the master page file in notepad +, removing the html, then putting it back in from visual studio.
Hope this helps someone!
Interesting, the uninstall of the "Visual Studio Web Authoring" program and the renaming of the Office setup.exe seem to both be related. I watched setup.exe as I uninstalled Web Authoring and the uninstall had the side effect of removing setup.exe and all the other contents of the directory. Also, when I had my setup.exe renamed to something else (e.g. 'setup.exe.renamed') then I had errors trying to uninstall Web Authoring. Those errors went away when I renamed setup.exe.renamed back to setup.exe. Anyway, just saving someone else a double effort here.
I have solved this problem by installing this hotfix:
http://blogs.msdn.com/b/webdev/archive/2008/02/09/downloadable-hotfix-performance-and-editor-fixes-for-microsoft-visual-studio-2008-and-visual-web-developer-express-2008.aspx
Try deleting ReflectedSchemas folder (C:\Documents and Settings[username]\Application Data\Microsoft\VisualStudio\9.0\ReflectedSchemas). This folder grows quickly (mine was 2.6 GB after 4 years of programming) and by growing can slow down the VS considerably. Such as 10-20 seconds of non-responsive UI after closing an aspx or ascx file. I has not waiting them to open, I was waiting to close. Apparently the opening was easy, the closing part was the hard job!
Uninstalling 'Visual Studio Web Authoring tool' solved this problem.
Related
I was coding with razorpages when randomly about 2 days ago the razor pages now display boths the cshtml and cs right away. earlier I could expand the cshtml to get to the cs file and i think it was a more compact that way
i think its options somewhere in tools->options->environment () but there are so many
after a few different google searches I found nothing helpful.
here is a picture of the problem:
earlier I could expand the cshtml to show the .cs files now i just see all of them and its kind of overwhelming.
enable file nesting in solution explorer
They're not being nested, is all. It's literally two separate files, Visual Studio just recognizes that it's a Core project, and then shows them nested, since it understands that they're related. If that's not happening, then that means Visual Studio doesn't recognize it as a Razor Page, which could be a problem with VS, the project, or something else entirely. It's essentially impossible to say what the issue might be, so you'll just need to try stuff. A few things I can think of to try:
If you're not using VS 2019, upgrade. Ultimately, this is part of the ASP.NET Core tooling, and best version of that is always going to be in the latest release.
Verify that you solution is building correctly. You might also consider deleting all bin and obj directories and rebuilding to ensure the build is truly up to date.
Close Visual Studio completely and re-open it. You may consider restarting as well. (You've probably already tried this though).
Try running Visual Studio in "safe-mode", which essentially just means disabling all the extensions you have installed. You can either manually disable all your extensions and then restart or close Visual Studio and start it via the command like with devenv /safemode. If this fixes the issue, then there's an extension causing issues. You'll probably need to just disable each one by one to see which on is causing the problem, and then either remove it or see if there's an update that corrects it.
If all else fails, repair Visual Studio. Run the intaller, and click the "More" link under the installation you're working with. Then click "Repair".
I've met with a strange problem. I had 7 projects in the solution. I had to add another MVC project. Now when the document (from the new project) is opened (for example HomeController.cs) and when this project is initializing at the start, it freezes the whole IDE like this:
(Some projects do not load)
After that, I have to kill the process. When I open VS again and fast click on another project (which is initializing) the freezing issue is gone. I have no idea what can cause a problem like this. I've tried with and without ReSharper but I get the same result. Also, I restored default settings of VS. Also repaired whole VS.
Maybe someone had the same problem and could give some helpful advice?
Usually removing of the hidden .vs folder in solution directory fixes the problem.
Possible solutions:
Delete .vs folder as mentioned above
Clear temp files from %USERPROFILE%\AppData\Local\Temp
Readjust source control in Tools -> Options -> Source control -> Plugins, set to None, Save, close VS. Then reopen it and reset the plugin.
There is no particular order, but one of them might help.
I experienced the same issue with VS 2019 and fixed it by deleting the user.json file from %USERPROFILE%\AppData\Roaming\Visual Studio Setup
EDIT
The issue reappeared after a few days, so I located the user settings for Visual Studio 2019 (%USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio\16.0_f124b472) and deleting the following files seemed to have reset VS to a normal state:
Current.vsk
User.vsk
ObjBrowEx.dat
Please close all your solutions before deleting the files
I used to have this problem, it was solved just by double clicking any of the stuck projects. This nudges the loading process somehow and causes unloaded projects to complete its loading.
Delete the .suo file in the solution folder.
I am pretty sure I found this answer somewhere on Stackoverflow before, but now I can't find it anymore. Credits to whoever came up with this.
None of above answers worked for me and found this solution.
By opening solution in safe mode devenv.exe /SafeMode will show you details about file causing issue and then
Search for all the files in the project directory with extension *.user
and remove them all
last reloaded the projects
For Visual Studio 2019, I cleared my %USERPROFILE%\AppData\Local\Temp folder.
It worked.
When you get over the past install multiply versions and the previous version was not fully uninstalled. This cause this issue in my case.
Control Panel > Programs > Programs and Features
Search for all Visual Studio related programs and Uninstall those.
Since I changed my windows password I can no longer type into a checked out file in Visual Studio 2013! Where before I just needed to start typing and it would check out the file in the background, now it won't even allow me to type into the file after I manually check the file out, from the solution explorer! It's as if VS 2013 is ignoring the keyboard on the project under source control. It's fine for other projects even project's under source control!
I think I remember seeing this before with older versions of Visual Studio and resolved it with a "Go online" option but I can't see that option in VS 2013, or the project is not "off line" so the option is not available.
This is obviously related to the TFS setting on the project but I simply cannot get past it. I am blocked and would appreciate any suggestions.
I suspended Resharper and restarted Visual Studio 2013. Once I reopened it the problem was gone. Resuming Resharper caused the problem to emerge again.
The solution is quite large so maybe that is it. Before putting Resharper into suspend mode I tried switching off code analysis thinking the workload is just too great, but that didn't help. The suspend did though. I hope this helps anyone else with the same issue.
All I have to do now is to figure out how to get Resharper back in the game without the problem coming back. We rely on Resharper as it is an wonderful tool. Since the solution has many projects in it, I am going to try create a smaller solution with my web project and just reference the other projects as assemblies. Maybe that will help
Update:
Clearing the resharper cache as suggested by Alexander resolved the original issue.
I'd like to add Alexander's comment as answer, since it helped me exactly to solve the issue:
Clean R# (ReSharper) caches by deleting all folders (and files) from the path
C:\Users\{User Name}\AppData\Local\JetBrains\ReSharper\v8.2\SolutionCaches\
and then reopen the solution.
Note: (Thanks to Antak for providing this info!)
You can paste
%userprofile%\AppData\Local\JetBrains\ReSharper\v8.2\SolutionCaches
into file explorer's path textbox (open it via Win+E, or use Win+R and paste the path into the command window), this will resolve the physical path into your user's directory automatically.
This happened to me. All my JavaScript files went "dead." By "dead" i mean that all the normal VS intellisense coloring/functionality was gone; js files were un-editable, although Resharper was still working sort of; all other non-js files seems to be normal. In addition to Resharper, I had also previously installed Web Essentials and was using both tools.
First, I cleared the R# caches as mentioned above by Alexander. After restarting VS, this DID NOT work. JS files still dead.
Then i disabled Web Essentials. Then I restarted. THIS WORKED.
I then re-enabled Web Essentials, restarted again, and all seems to be OK. Am crossing my fingers....
I too had this problem with the latest version of ReSharper (9.0.0.0), but clearing the cache as stated above did not work. I actually had to go into my ReSharper options (ReSharper -> Options -> General) and click the "Clear Caches" button. Once I did this and restarted VS everything is working again.
Try: /safemode
I had a similar problem where I could not edit most of my files, but I could edit *.ps1 files.
I don't have TFS, I do have resharper and other plugins.
What worked for me was:
Start visual studio in safe mode: C:\..\IDE>devenv /safemode
Close VS.
Start VS normally.
That probably has the same effect as suspending and resuming resharper, but I'm not sure which plugin could be causing the problem. If you are having trouble this is something you could try.
I hit the refresh(restart) and it solved a similiar problems so maybe you better try that before an IDE restar. ctrl shift F5
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" />
We have a really big solution with more than 200 projects and thousands of files. Despite of that the solution used to load pretty quickly in Visual Studio 2010 as well as 2012. However, after copying the whole SVN repository to another location, loading and closing the solution suddenly took extreeeemly long. (I am talking about 30-60 minutes here!)
I found a solution myself and I wanted to share it here, hoping that it might save someone quite a few hours of research and staring at the "Preparing solution..." dialog.
When inspecting the devenv.exe process with Process Monitor, I found out that it is pretty busy with accessing the .svn directory. Here is what I did (and this somehow solved the problem):
Kill Visual Studio
Open Visual Studio without loading a solution
Disable AnkhSvn as Source Control plugin (Tools->Options->Source Control->Plug-in Selection->None)
Disable "Document Well 2010 Plus" (VS2010) or "Custom Document Well" (VS2012) in Productivity Power Tools (Tools->Options->Productivity Power Tools) - I read that somewhere and it might have helped as well...
Close Visual Studio
Delete the solution's *.suo file. This is located in the same folder as the solution itself. NOTE: You will lose several settings for your solution, like currently opened files, breakpoints, bookmarks, current solution configuration & platform (e.g. Debug x86) etc.
Restart Visual Studio
Load the solution - it was much faster now!
Close Visual Studio
Open Visual Studio without loading a solution
Re-enable AnkhSvn and the "Document Well"
Restart Visual Studio
Open the solution - it was still loaded in seconds!
I do not know which of these steps actually solved the problem. Probably, not all these steps are required, but I did not want to reproduce the problem to find out which steps may be omitted. :)
None of those helped me, what I did... I watch with ProcMon of sysinternals, filtering for devenv, and I saw a lot of entries of fussionlog. I had enabled fussionlog for debugging purposes some weeks before and didn't think in disabling it. I just had to disable fussionlog and the solution opened faster.
You can open the Visual Studio in the Safe Mode, and then check your plugin and source control settings after opening the project.
Safe Mode means "Starts Visual Studio, loading only the default environment and services."
How :
devenv /SafeMode
Or according to your path
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" /SafeMode
source : https://msdn.microsoft.com/en-us/library/ms241278.aspx
In my case, the following worked without any of the intervening steps suggested:
Kill Visual Studio.
Start Visual Studio directly (i.e., not from the .sln file).
Then, from within Visual Studio, open the solution.
In my case this was all it took to make the problem solution load quite quickly, without the need for me to change any settings or delete any files.
fwiw, I realize this is a late entry, but I found that simply removing (deleting) my large number of breakpoints resolved the excessive load time and compile time.
This action reduced the size of the .suo file from 214MB to 977KB. Let VS handle the .suo file itself.
Compiling and loading now takes < 1 minute instead of 5-10 minutes for a solution with 35 projects. Visual Studio 2012 Pro, update 4.
None of the other answers worked for me. CI compile times were fine, but loading my solution in Visual Studio was taking almost two minutes. VS would then operate just fine until I closed and opened the solution the next time. Different versions of VS all showed the same problem and both safe mode and deleting the suo didn't help.
I ended up following the advice in http://geekswithblogs.net/akraus1/archive/2014/04/30/156156.aspx to use Windows Performance Recorder to instrument VS and find the problem. By looking in Windows Performance Analyzer under the "CPU Usage (Sampled)" section and adding the "Stack (Frame Tags)" column, I was able to dig into the usage of devenv.exe.
Turns out the hot path by count had Microsoft.VisualStudio.Platform.WindowManagement.ni.dll 23 calls down, and below that eventually Microsoft.VisualStudio.ServerExplorer.dll and Microsoft.VisualStudio.Data.Package.dll. That pointed me to look in Server Explorer in the UI and open the Data Connections tab. There I found hundreds of mistakenly added connections that came from the debug web.config's ConnectionString section. Removing those from web.config reduced the load of that individual project from 90+ seconds to almost instant.
I have a different cause for the slow loading of the projects.
My situation is utilizing Git and found that even switching branches was slower than it should be with project load.
Solution: Run Visual Studio as Administrator
Reason: Something with the Corporate laptop is not providing the needed Git tool access (it doesn't recognize that a git repository is in use).
I have not seen any issues with Git or my personal access to any of the project files or Git objects.
I tried the above, but it didn't solve my problem.
Here's how I got around this problem, hopefully it will work for some of you as well:
Open Visual Studio 2013 with no solution.
Create a new C# Console application and save it.
Close Visual Studio.
Reopen the Console solution created in step 2.
Close Visual Studio.
Reopen the solution that was previously hanging on the Preparing Solution dialogue. Mine opened right away, no more hanging.
Using Visual Studio 2015, I ended up creating a new solution, adding the existing projects.
Deleting the *.suo from gehho's answer helped in the past, but didn't help me in this case. There's also another .suo file in a hidden .vs folder at the root of the solution.
There are other answers here for Visual Studio 2015 Visual Studio 2015 is extremely slow
For my case it was due to TFS issue. It thinks that there are more than 5000 pending changes.
The fix is to force TFS to recheck. Go to Team Explorer -> Source Control Explorer and do "Get Latest" on the projects that have pending changes. For things that are already matching TFS, Visual Studio will actually not download anything to your PC. For things that are different with TFS, Visual Studio will let you know and ask you to reconcile the difference.
This is VS 2019 Professional.
In my case there were <import ...> entries in the project files that pointed to
paths no longer available making the loading of the solution hang indefinitely without any form of information give (Shame on Microsoft!).
I encountered this problem only recently (Mar 2021), using VS 2019. It literarily takes 30+ seconds to load the file (each).
It only effects the Layout files. I believe it could be to do with the links within the files. I have not had time to investigate them.
However, I am writing this to suggest that regardless of the cause of the problem, a simple solution is to right click on the file and open it with Notepad to get your work done.