I have having the weiredest problem. To clean up some version control issues I took the time to take an existing solution (which has 2 projects in it, one a web application and one a number of clases) and move it to a new, clean solution. I realized after moving it that in some of the pages the debugger breakpoints werent working. In some pages it does, but it some it doesnt. I made sure all the switches and properties were set, deleted \bin files, etc etc. But as I said in some pages breakpoints work, in some they dont. I went so far as to delete an offending page entirely and rather than copy it in from the old solution, I re-built it from scratch. Still no breakpoint. And here is the kicker: if I make one of the pages the breakpoint doesnt fire in the start-up page, the breakpoint works correctly. Its when I hit it from a link in the site the breakpoint doesnt fire.
VS2010 Pro, Local IIS (same behavior if I run it under Cassini), Windows 7.
Related
Visual Studio 17.1.0
net6.0
I have a .net6 web app. Anytime I make a change, hot reload, and then hit a break point I get the 'Edit and Continue Applying code updates...' popup. Every break point I hit after that, it pops up and won't go away unless I restart the app. Doesn't matter what the code change is. It could be adding a comment to a .cs file.
Even if I don't hot reload it causes issues. Say I add a comment to a .cs file but don't save. Same thing happens and restart of app is needed.
Basically hot reload just doesn't work and not worth having enabled. That Edit and continue screen takes 1-2 minutes to complete each time.
I just fixed this. It appears that since this was either
VS 2019 project
dotnet 5 project migrated to .net6
Both 1 and 2
That not all the settings followed it. I ended up creating a .net6 MVC project from scratch and compared everything. The one change I did that corrected it was adding the debug source files under
Solution | Properties| Common Properties | Debug Source Files
For some reason mine was blank.
I am using VS 2017 and whenever I've closed a project in the past, the same tabbed windows are automatically opened making it easy to get going where you last left off.
As of several months ago, the same old set of windows that I had opened months ago reopen each time I restart VS. This means that I must close all of the old VS windows that I no longer need and manually open the ones I do.
It's like if my IDE state is not being saved anymore. I've deleted everything in my %USERPROFILE%\AppData\Local folder but this made no difference at all. Additionally, I verified that my project files were not set to 'read only' but this did not help.
Any suggestions?
P.S. I had forgotten to mention that old and obsolete breakpoints will always be set each time you open a project.
The person who deserves credit is Sergy Vlasov for solving my problem.
There was one additional issue that I had not mentioned, one that bothered me for a few months. Some parts of my code had red error lines underneath even though my code would build fine.
The resolution to this was to simply close VS, then delete the .vs hidden folder within my project. Upon restarting VS, those lines were gone.
I had a Windows Forms application that needed some UI and code changes changes made to it. I made the proper changes (mainly deleting a few controls and moving some code). Oddly after the changes were made, I would rebuild run, and despite the changes, the changes being saved, and builds being made multiple times,the application would always run as if the changes were never made.
I tried to Build -> Clean Solution a few times, with no avail. I decided to try manually deleting the bin and obj folders and rebuild. However, after closing the solution, deleting those folders, I tried to build again and get the following error:
OutputPath and AssemblyName are set correctly as far as I'm aware. This only affects Debug, Release runs fine (sort of) and even in debug XML and *.vshost files are created, but not the executable. I've tried restarting VS a few times to no avail. What in the world did I do and how do I fix it?
EDIT After right clicking on the solution and doing a batch-build on all projects in the solution, things started working. I still have no idea what happened, so if anyone has any theories feel free to comment.
Does the Output window provide any details about where the .exe was created?
You may need to increase the verbosity of the logging. To do so, go to the Options dialog (Tools > Options) and open "Projects and Solutions" > "Build and Run." Change the "MSBuild project build output verbosity" and recompile.
Wondering if anyone has a solution to this 2010 bug. I have a project that built fine in Visual Studio 2008 that wont build in 2010 because Visual Studio is holding on to the dll after the application is run ONLY if a designer window is open. I created a really light weight project that shows this problem. If you create an application then create a lib dll. Put one form in the dll, open the form in design view and then run the application. It will run fine, then close the app, go to the code view of the form in design view, and change the code ( I just renamed a single variable) then try to recompile you get the following:
Error 1 Unable to copy file "obj\Debug\customlib.dll" to "build\debug\customlib.dll". The process cannot access the file 'build\debug\Customlib.dll' because it is being used by another process.
If you run Process Explorer and search for the dll, the only process holding the dll is devenv.exe!!!
I have done a ton of searching on this problem and have found similar issues with older versions of Dev Studio where people were able to just add a pre-step to move the locked dll to another name (.locked) and build. Well that works the first time, but the next time you run then edit you are locked out of both the current dll and the one you moved to .locked, so unless I am willing to add code to randomly generate a name for the locked dll, this wont work for me (I don't want my debug directory size to grow with files never getting deleted.)
I have only found one workaround and if you are in this same boat this is what I have to do to edit and run. I make sure EVERY design view window is closed BEFORE I ever run my project in the debugger. If you close all the open design view windows devenv.exe will not hold the dll.
Does anyone have a better solution to this problem?
I'm not sure whether this will work for you or not, but this similar question if you have this line in AssemblyInfo.cs:
[assembly: AssemblyVersion("2.0.*")]
changing it to:
[assembly: AssemblyVersion("2.0.0.0")]
will solve this isue.
The Visual Studio add-on "VSCommands" claims to have a fix for this problem. I've not tested it yet, but it also claims to have an in-IDE stackoverflow reputation tracker which intrigues me :)
Your "Close designer before debugging" workaround seems to be working for me (so far), for which I'm very grateful. It was beginning to get to the stage where am large part of my day was spent in the following workflow...
F5
loud expletive
ALT F4
WIN 3
waits impatiently...
F5
I have had the same problems for a long time and then suddenly they disappeared. I realized that the source of the problems was initializing code in the constructors of WCF services and WPF controls. After cleaning the constructors from any dependencies to other assemblies everything has been fine.
So my suggestion is: Clean your constructors.
In WPF it is possible that inserting:
if (DesignerProperties.GetIsInDesignMode(this)) return;
or similar will have the same effect.
In Visual Studio 2010 I've created a Silverlight app by choosing the "Silverlight Business Application" template.
I changed some code in Home.xaml.cs, closed Visual Studio, opened it again, and began making more changes.
But now the changes that I make to the code don't take effect at all. It's as if the entire application is cached. I can even delete the whole contents of the Home.xaml.cs file so it is blank, and pressing F5 shows me my original Silverlight app. This happens both in Firefox and Chrome. I've rebuilt, deleted the bin directory, but it keeps showing me the same old application.
What do I need to change in this template so that I can make changes to the code, and see them reflected in the application?
Addendum:
I created a new Silverlight Business App, copied all the code to it, and this caches after the first change as well.
So it occurred to me to go into BusinessApplicationTestPage.asp and chang the link to the .xap file:
<param name="source" value="ClientBin/BusinessApplication4.xap?id=111"/>
So i've "fixed" the problem in that I change the id each time I run the application. And I suppose I could put a random number generator in here so that it refreshes each time. But... is this the intent? Isn't there an easier way to develop without this caching, and then only when deploying to cache like this?
Update:
Ok, just by adding that ?id=111 once, it recognizes each change now. Perhaps...
Start by using Control-F5 in IE. This not only refreshes the page, it clears the browser cache so in theory you will download a new version.
If weirdness like this is still happening you need to delete the contents of these folders...
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
This is such a well known pain-point in older versions of Visual Studio that most web developers I know have batch files specifically for cleaning out those directories.
These folders exist so that you can alter ASP.NET applications while the application is still running. IIS will detect the changed files and copy them to the temp directory while it silently restarts your web site. Alas this doesn't always work correctly, especially when running under the IDE.
I know this isn't an ideal solution, but I have found that the IE9 Beta caches XAPs much less aggressively than other browsers, and I don't face this problem when running my Silverlight applications in it.