I’ll be debugging a site in Visual Studio 2010 and editing an *.aspx or *.ascx file, and without warning, it will lock up so that I can’t edit it. There’s no message or anything, I just can’t type or make any changes.
The only way to start editing again is to stop debugging, close the editing window, and then find whatever file I was working on and reopen it. It’s a huge pain in the you-know-what.
My colleagues are experiencing the same thing, so it’s apparently not something with my particular setup.
What’s the explanation, and how can we make it stop?
Note 1: I’ve reported this to Microsoft here. If you’ve experienced this as well, please go there and vote up the bug report.
Note 2: This is not VSS-related, at least in my case. We use VisualSVN, which doesn’t use file-system-level locking to mark files as checked out.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Finally Microsoft came with a solution this year, you can download the fix here:
http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=40811
Method 2
I’ve found a temporary workaround-solution:
Right-click on the file and select “Open with…”. Now select “Source Code (Text) Editor” and you can edit the file again but without IntelliSense 🙁 But you won’t need an external editor.
Nevertheless we still have to wait for Microsoft to find a better solution.
Method 3
As a workaround I use “Browse With…” (Right click in Solution Explorer) to load and view the page(s) when I’m making HTML refinements. You can’t debug code of course but it doesn’t lock the files so it makes the problem a little less irritating when making design changes.
I have replicated this issue with Windows 7, XP, both with and without source safe, MVC projects, web application projects and website project also with and without ‘edit and continue’ enabled i.e. I can edit the code but NOT the ASPX markup when using edit and continue!
Method 4
I experienced the same issue, and found out that for me it occurred only in .aspx pages with an "eval" statement (used for databinding within e.g. a gridview) within <a> tags. As soon as I removed the "eval" statements, the pages became editable again while debugging.
Example of code causing the page to be readonly while debugging:
<a href='<%# Eval("URL") %>' target="_blank"
title='<%# Eval("URL", "Open url: {0}") %>'><b>'<%# Eval("Text") %>'</b></a>
Example of replacement code causing the page to be editable again while debugging:
<asp:HyperLink NavigateUrl='<%# Bind("URL") %>' runat="server" ID="hlURL" Target="_blank"
ToolTip='<%# Bind("URL", "Open url: {0}") %>' Text='<%# Bind("Text") %>' Font-Bold="true" />
Method 5
I was just having the same problem. When the code page disappers, I click debug->restart. It restarts the debugging process, and show all the pages I had open.
Method 6
Usually this is because of your version control system making the files readonly (namely VSS). Go into the settings for source control and set the editor so that it will checkout files when edited.
If it is not your source control, then it is that the files are being made readonly by something, and that ‘something’ is what you need to find to fix this problem.
Method 7
I get the same using VS2010, random file locks galore… however i find that if i close the file in question and re-open it i can continue editing i.e. i don’t necessarily have to stop the whole program running.
Method 8
Have you and your collegue got Microsoft Office 2007 or 2010 installed? Run the Office setup from CP > Programs & Features and do a Repair. Reboot afterwards, or at least log out.
I’d understand if you don’t want to do a full reinstall of Office, but if the repair doesn’t fix this, I would suggest it.
Method 9
Using “devenv.exe /resetsettings” will restore Visual Studio back to its original factory state.
You can also use “devenv.exe /log” to log Visual Studio activity for troubleshooting:
http://msdn.microsoft.com/en-us/library/ms241272.aspx
Method 10
I can tell you it is known bug.
It always happen when you edit on CSS or Javascript in Code View.
I have report to MSDN forum and Microsoft Connect, but it seems it is rare bug,so not many people to solve that.
Method 11
I have this problem and also have Resharper installed. Do those of you with the problem also have Resharper installed? I seem to have memory leaks in VS also that eventually bring VS to a crawl. Closing VS and re-opening it will fix the issue for a while. I have always assumed this was related to Resharper. Thoughts?
Method 12
Try refreshing project containing that file, from the solution explorer. That should re-enable editing.
Method 13
Had the same problem with VS2010. R-click on the ASPX file and select the XML EDITOR — then editing is enabled.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0