views:

822

answers:

9

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.

+1  A: 

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.

Stargazer712
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
In that case, Heinzi is probably right. Its probably a bug with VS that should be reported :)
Stargazer712
A: 

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
Thanks, @devastated - welcome to SO. Since this isn't a proposed answer or solution to the posted question, it would be more appropriate as a comment to the question.
Herb Caudill
@Herb - you can't comment on other people's questions / answers until you have 50 reputation.
Jason Berkan
@Jason - Noted. Still, "I'm having this problem too" isn't an answer.
Herb Caudill
FWIW This isn't my experience. I need to stop debugging in order to regain editing access to the aspx/ascx file.
Herb Caudill
A: 

Have you tried the options under Project Properties > Web tap page? There is an option to Enable Edit and Continue when you are debugging your application under Visual Studio Development Server.

Optionally, you might need to check on Tools > Options > Debugging > Edit and Continue features as well.

/KP

Kosala Nuwan
To amplify on that, it's easy to begin editing code thinking you have ceased your previous debugging session when in fact you haven't - in those cases, you can't edit if you haven't enabled the edit and continue features
Mark Mullin
To clarify: This isn't an issue when I'm editing code - I'm editing markup on an .aspx or .ascx page. These should be editable regardless or whether or not I'm debugging and/or have edit and continue turned on.
Herb Caudill
Herb: Markup on an ASPX page *is* code! It just gets compiled to a string literal inside of some actual C# (or VB) file that you never see.
Gabe
@Gabe: Be that as it may, my experience has generally been that you can edit an aspx page while debugging, while you can't edit VB code. That's still true, most of the time; the locking up is intermittent and unpredictable.
Herb Caudill
A: 

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
I don't understand - how would my Office install affect VS2010?
Herb Caudill
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
A: 

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
Even a fresh installed Visual Studio 2010 has this issue...
Olaf Watteroth
Interesting.. wonder if it's same for both types of Web project templates?
IrishChieftain
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 ;-)
Olaf Watteroth
+1  A: 

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.

Olaf Watteroth
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
+1  A: 

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
Sure, you can accomplish the same thing with Ctrl-F5 (start without debugging).
Herb Caudill
A: 

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.

SilverNight
A: 

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
No, don't have resharper.
Herb Caudill