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.
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!
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" />
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.
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.
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.
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?
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.
Related
i have problem with Visual Studio 2010 on Windows 7 x64. When i started asp.net site debugging, it stoped working. Only solution is restarting IIS.
Have anyone experiences with this?
Thanks
As Peter mentioned, manually attaching through the Attach to Process dialog should work.
Another option is to temporarily update your project to .NET Framework v4.0. In the IDE, this can be done in 'Build' section of under project properties.
We are still investigating the issue to find a longer term solution.
Sorry for the inconvenience that this problem has caused.
This M$ Connect article points straight to the topic: http://connect.microsoft.com/VisualStudio/feedback/details/556000/vs-2010-hangs-when-debugging-asp-net-3-5-web-application-or-website
Apart from the different intermediate solutions proposed, there seems to be an official Microsoft VS 2010 HotFix available here: http://archive.msdn.microsoft.com/KB2106584/Release/ProjectReleases.aspx?ReleaseId=4834.
HTH
Here's a workaround that helped me:
Go to Debug->Attach to Process. If the 'Attach To' box says 'Automatic: Native code' then click the 'Select...' button. In the 'Select Code Type' dialog change the option from 'Automatically determine the type of code to debug' to 'Debug these code types' and choose ONLY the options for you project. For me this was 'Managed (v2.0, v1.1, v1.0)'. Click OK. Then click Cancel in the 'Attach to Process' dialog.
At this point I'm now able to do F5 Debugging.
I hope this helps!
For what it is worth I had this problem this morning out of nowhere. In my case I am converting a database into webpages and one of the folders of one of the projects in my solution now has over 200 thousand html web pages. As soon as I one off'd my solution and removed the project with the giant folder debugging worked again.
This is not unlike what happens when performing a global search and vs 2010 tries to search a folder with an enormous # of files.
I am working with an ASP.NET website that is currently being referenced by IIS. When I open .aspx files for editing, the pages seem to hang randomly - has anyone else experienced this? Is there a known cause (and solution)?
Thanks
I had the exact same problem but maybe another cause.
If you use GIT in your visual studio, turn of "Show current branch in Visual Studio".
All of my lag went away in an instant.
Something that seems to exacerbate this problem is non-compliant markup, but it can often happen with control libraries and also happens occasionally with the vanilla controls for no apparent reason.
You might want to change the default to "source view" rather than "design view". You can do this, in:
Tools >> Options >> Html Designer >> Start pages in
When I try to edit an ASPX file with the Design View it freezes for a moment and does nothing, not even an error message.
Looking through menus I've seen some strange things:
If I go to Tools->Options->HTML Designer it gives me no options on the right panel, just a "Error loading property page" message.
When I try to open a file using "Open With..." there should be something like "Web Form - Editor", but it is missing and I can only open them using Code View.
I've tried repairing Visual Studio and reinstalling WebDesignerCore, but nothing works. Anyone had the same problem?
This seems to be a known bug with Visual Studio 2008 - you could try the hotfix for this issue.
Tools > options > international settings, then set the language to English solved my problem.
Not a final solution but I installed Visual Web Developer Express and then associated aspx files to %Program Files%\Microsoft Visual Studio 9.0\Common7\IDE\VWDExpress.exe
Getting closer to the final solution. If I start a Windows session with another user, the designer works as it should, although when I go back to the first user it still doesn't work.
This may be a stupid question, but it's something that bugs me on a regular basis, so no harm in asking here I guess.
What exactly is Visual Studio doing when I open up an .ASPX file and it takes a good 4-5 seconds longer than if I was just opening the code behind file (.ASPX.CS).
I've noticed this happening with VS 2003, 2005 and 2008, and on a newly built machine too, so it's not an issue of my dev machine being too slow.
It seems to only happen when opening any .ASPX file for the first time in a particular session though. Is there some processing going on that I can disable to get rid of this delay?
Cheers
Because Visual Studio has to process the aspx files to represent them in design view. Source files do not have a design view.
It probably caches what it needs for design view. This will make things faster the next time it wants to load the file.
I just disabled HTML designer:
Tools -> Options -> HTML Designer ->
"Enable HTML designer" uptick it.
Works much more faster. Tested in VS12.
To speed up VS opening .aspx files, you can right-click on them and choose View Markup, which will take you directly to the HTML without it opening the design view.
Of course as soon as you try to switch to design view again it'll take a couple seconds to load the page up.
You can take weiran´s advice or if you just want to double-click da aspx file without the delay hassle...In VS go to:
Tools -> HTML Designer ->
"Start Pages in" section - pick "Source View"
"Smart Tags" section - Uncheck "Automatically display Smart Tags....view"
Another possible reason is the number and complexity of custom user controls defined in Web.Config in the <system.web>/<pages>/<controls> section. Removing them from the Web.Config significantly improved the speed at which aspx and ascx files loaded in Visual Studio (VS 2010 specifically). Of course, they need to be registered in the aspx/ascx files that use them, but I don't pay the penalty on every file.
I have VS2005 and I am currently trying to debug an ASP.net web application. I want to change some code around in the code behind file, but every time I stop at a break point and try to edit something I get the following error message: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged is optimized."
I'm pretty sure I have all the "Edit and Continue" options enabled. Any suggestions?
This may seem counter-intuitive, but turn edit and continue off.
There might be another "allow me to edit read-only files" or "allow me to edit even when I am debugging...no really!" setting somewhere, but I don't have 2005 to look at to check.
In 2008, turn off edit and continue and you can edit while it's running (but those changes aren't appplied.)
If you actually want to use edit and continue, you also have to enable it for the project, on the web tab of the project settings.
The application is actually running off of a compiled version of your code. If you modify it it will have to recompile it in order for your changes to work, which means that it will need to swap out the running version for the new compiled version. This is a pretty hard problem - which is why I think Microsoft has made it impossible to do. It's more to protect you from THINKING some changes were made when they really weren't.
For Asp.net it is possible to think of two types of 'edit and continue'.
One is a classic edit and refresh the browser. This works because the browser refresh recompiles everything except precompiled code behind files. This is not referred to as Edit and Continue, though in practice it provides a similar effect. In this mode you cannot change code behind files, because they were precompiled and deployed, but you can change just about anything else.
Another mode allows you to change precompiled code behind files but nothing else ... (this is the mode Chris Bilson mentions which needs to be set on the project properties for ASP.Net). In this case you are using the Edit and Continue feature of the debugger, which knows preciously little about ASP.net. The debugger just sees a loaded .Net assembly and can modify it when stopped in the debugger because there is a project in the solution that claims to know how to build it. In this case you are prevented from modifying things that would otherwise mess up the debugging session. This method however is the only way to change the code while it is running rather than requiring a browser refresh.
You are allowed to make changes to the *.aspx file while it runs, and you can hit refresh on your web instance to see those changes immediately. However, you cannot make changes to the *.cs/*.vb or *.designer.cs/*.designer.vb files while the program runs.
I search for this on Visual Studio 2008 WAP (Web Application Project) and it took me two days to find the solution, so here it is in the hopes it helps somebody else:
There are two locations that have to be checked, one it under tools-options-debugging-Edit And Continue-Enable Edit And Continue, the other is right click project-properties-Web-Enable Edit And Continue
For the record, I had a similar problem with VS 2008 and a different solution resolved the problem for me. Editing code in Visual Studio 2008 in debug mode
Check that you are not in release mode.
In release mode you cannot edit your code while debugging. Just change mode to Debug