简体   繁体   中英

Editing aspx/ascx files randomly disabled in Visual Studio 2010?

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.

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

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

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.

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.

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 ie I can edit the code but NOT the ASPX markup when using edit and continue!

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 eg 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" />

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

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

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.

我得到了相同的使用VS2010,随机文件锁嘉豪...但是我发现如果我关闭有问题的文件并重新打开它我可以继续编辑,即我不一定要停止整个程序运行。

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.

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

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.

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM