42

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.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
Herb Caudill
  • 50,043
  • 39
  • 124
  • 173
  • Since this looks like a bug, http://connect.microsoft.com might be the most suitable place to report this. – Heinzi Aug 10 '10 at 15:33
  • Thanks, I've reported it here: https://connect.microsoft.com/VisualStudio/feedback/details/585751/aspx-and-ascx-files-randomly-freeze-up-become-uneditable-while-debugging – Herb Caudill Aug 12 '10 at 13:40
  • Do you have any .net (vb/c#) code included in script tags on the page that locks up, or do you use code behind files for all compiled code? – StingyJack Aug 12 '10 at 17:51
  • @StingyJack: No, there are no script blocks. All VB code is in code-behind. – Herb Caudill Aug 12 '10 at 20:54
  • 2
    I seem to have a similar problem, except in my case, VS2010 doesn't fully lock up, just for certain keys. The Enter, Backsapce, arrow keys stop working. This only happens when I were in debugging mode. I haven't found the exact trigger though. – William Niu Aug 16 '10 at 13:23
  • Similar problem here. I up-voted the issue on the connect site. Happens frequently in a VS 2010 VB MVC 2 project. If I close the file and immediately re-open it, it is editable. – pettys Aug 17 '10 at 16:18
  • Is it a Web Site project or a Web Application Project (presuming it's Forms and not MVC)? You may want to update the Connect bug report with this info... – IrishChieftain Aug 19 '10 at 17:26
  • 2
    I just found that, the file being edited doesn't need to be closed to re-enable keys, just need to switch to another file and back. I assume opening an arbitrary file and close it would do as well. – William Niu Aug 25 '10 at 06:07
  • I have similar problem, but in my case switching to another code file and then switching back to original restores all keyboard events – Tx3 Sep 23 '10 at 06:03
  • Do you have VSS or TFS? What version control are you using and does it attempt to auto-check out files on edit? Are those files you are editting already checked out by someone else? Does this happen only on MVC or does it also happen in WinForms? I personally have never seen this happen and cannot reproduce it in Visual Studio 2010 using TFS. – hyprsleepy Sep 23 '10 at 21:26
  • @hypersleepy - We're using VisualSVN. There's no checking in or out and no file locking. The sites are traditional (WebForms) ASP.NET. – Herb Caudill Sep 24 '10 at 13:06
  • I have never used VisualSVN but I did search on it and it appears it can do locking and commiting of changes and merging, etc. http://www.visualsvn.com/support/topic/00016/ – hyprsleepy Sep 24 '10 at 14:37
  • Maybe you can get better answers if you add VisualSVN to your tags? – hyprsleepy Sep 24 '10 at 14:38
  • This isn't a VisualSVN issue, it's a Visual Studio issue. Should I list every single piece of software I have installed on my computer as a tag? – Herb Caudill Sep 24 '10 at 23:24
  • Interesting. Is this something that can be repoduced easily enough? Having a repro would help a lot. – Oleg Tkachenko Sep 28 '10 at 04:20
  • I think it is a VisualSVN issue. If it were just a Visual Studio issue then why doesn't everyone who has Visual Studio experience the same problem? It never happens to me and I use Visual Studio. – hyprsleepy Sep 28 '10 at 19:56
  • @hyprsleepy - It could be a VisualSVN issue, but it could be a lot of things. It's equally possible that it's related to some other piece of software I have installed (virus checker, backup software, etc). So while it might be useful for everyone who is having this problem to post a list of software they have installed to see if there's something in common, the question tags aren't the appropriate place for that. – Herb Caudill Sep 29 '10 at 13:45
  • @hyprsleepy - File locking is something that you can optionally do with specific files in Visual SVN, for example a binary file that can't be easily merged. It doesn't use locking across the board like VSS does, and the files I'm trying to edit aren't locked. I can edit them in other software, just not in VS2010. – Herb Caudill Sep 29 '10 at 13:46
  • @Tx3 - I tried switching to another file and back again, doesn't work for me. The only thing that clears it up is to stop the web server, close the file in question, and reopen it. – Herb Caudill Sep 29 '10 at 13:47
  • Well, one of the people who commented on your bug report on Microsoft's website also said they use VisualSVN. I have a feeling it is a setting in VisualSVN that can be modified. – hyprsleepy Sep 29 '10 at 18:18
  • You might want to follow this thread: http://stackoverflow.com/questions/1598052/visual-svn-and-visual-studio-2010-beta-2-wont-play-nice – hyprsleepy Sep 29 '10 at 19:04
  • Did you ever hear back from Microsoft? Did this get resolved? – hyprsleepy Oct 13 '10 at 18:16
  • What OS are you using? and important what architecture? For example: Win7 x64 – Robert MacLean Oct 14 '10 at 10:41
  • @hyprsleepy - No, no love from MS so far. https://connect.microsoft.com/VisualStudio/feedback/details/585751/aspx-and-ascx-files-randomly-freeze-up-become-uneditable-while-debugging?wa=wsignin1.0 – Herb Caudill Oct 14 '10 at 18:59
  • FWIW Microsoft finally seems to have been able to reproduce this and is working on it again. (See the MS Connect link above) – Herb Caudill Feb 18 '11 at 22:20
  • 1
    A patch is finally out (yay!). Joost Schepel's answer below contains the link. – mkataja Aug 06 '12 at 08:47

13 Answers13

11

Finally Microsoft came with a solution this year, you can download the fix here:

http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=40811

Joost Schepel
  • 626
  • 9
  • 21
  • Haven't tested this extensively but it seems to have fixed the problem. – Herb Caudill Aug 06 '12 at 16:16
  • Finally!! Yeah... Did not expected them to ever fix that annoying bug. – OlafW Aug 07 '12 at 17:14
  • Link seems broken indeed, but what Herb mentioned works (stop debugging, close all documents, reopen). I restarted VS which didn't work, you gotta close the docs. – James Jul 23 '15 at 11:56
4

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.

OlafW
  • 700
  • 6
  • 22
  • I'm provisionally marking this as the answer, just because it's the best workaround I've found so far. I've just set the HTML editor as the default for .aspx and .ascx files. It's a shame, because you lose a lot of VS's goodies - not just intellisense, but other related niceties like automatic formatting. But it's better than periodically having to shut everything down and re-open just to continue editing my markup. – Herb Caudill Oct 14 '10 at 19:02
1

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.

Eugene
  • 11
  • 3
1

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.

riwalk
  • 14,033
  • 6
  • 51
  • 68
  • Thanks - that doesn't seem to be the issue here. First, we're not using VSS, we're using VisualSVN, which doesn't lock files. I've checked and when this happens, the file is not marked read-only. I can easily edit it in Notepad, and the changes are immediately reflected in VS - but I still can't edit in VS unless I go through the stop debugging/close/reopen dance described above. – Herb Caudill Aug 11 '10 at 14:41
  • In that case, Heinzi is probably right. Its probably a bug with VS that should be reported :) – riwalk Aug 11 '10 at 14:52
1

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.

devastated
  • 11
  • 1
1

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.

Simeon
  • 5,519
  • 3
  • 29
  • 51
  • 1
    I don't understand - how would my Office install affect VS2010? – Herb Caudill Aug 16 '10 at 19:11
  • 1
    Several bugs in Visual Studio in the past have been related to MS Office. As an example, shared libraries between the products locked VS2008 in a similar way for ASPX files, though you had to restart VS in order to continue working. In that particular case, repairing or removing the MS Office Web Authoring Components was the solution. – Simeon Aug 17 '10 at 08:50
1

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

IrishChieftain
  • 15,108
  • 7
  • 50
  • 91
  • Interesting.. wonder if it's same for both types of Web project templates? – IrishChieftain Aug 19 '10 at 17:24
  • For me it's a ASP.NET MVC 2 project. But as you can see on the bug-report-link MS acknowledge the bug so far they forwarded it to the dev-team... or at least closer to them ;-) – OlafW Aug 19 '10 at 17:37
1

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!

BradB
  • 977
  • 1
  • 8
  • 14
1

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" />
Joris
  • 21
  • 3
0

Try refreshing project containing that file, from the solution explorer. That should re-enable editing.

Patrick
  • 1,019
  • 13
  • 16
0

Had the same problem with VS2010. R-click on the ASPX file and select the XML EDITOR -- then editing is enabled.

0

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.

Cheung
  • 15,293
  • 19
  • 63
  • 93
0

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?

Matt Cofer
  • 2,972
  • 1
  • 20
  • 18