Source Change Does Not Appear in Debug

Category: c# ide

Question

Chargeback on Mon, 23 Feb 2009 00:18:28


I have Visual Studio Standard 2008.  I am working with a new WPF windows c# project (not that it should matter).  Frequently I make a change in a c#class or xaml file and the change seems to be ignored by VS.  I press debug and my old code is operating.  I have tried Build, Rebuild, Clean and Save All.  No combination consistently works.  I have even deleted the startup xaml file and the program still debugs as normal displaying the contents of the deleted file.  Changes not taking place seem to happen more when I remove code from a form such as a button definition.  If I add a button it usually does appear.  My fix is to close VS and delete the contents of the obj folder and sometimes the bin folder as well.  Is there a setting to tell VS to cache nothing?  Right now I have changed a debug statement to write Hello2 instead of Hello.  No amount of saving, rebuilding, or building is making Hello2 write instead of Hello.  The code is in a class.  Is there a fix for this situation?  I am new to 2008 so it is probably something I am doing but I cannot figure it out.  Thanks.

Replies

CoolDadTx on Tue, 24 Feb 2009 14:21:09


My initial hunch is that what you are debugging is not your code.  Go to Tools\Options -> Projects and Solutions\Build and Run and confirm that Before Building says Save All Changes.  Verify that On Run, when projects are out of date is set to Always Build.  Verify that On Run, when build or deployment errors occur is set to Do not lauch.  Verify that there are no build errors in the build log and that VS builds your project when you try to run.

Did you happen to make any changes to the Project\Debug settings?  Is your startup project the WPF app that you are making changes to?  Have you applied SP1?  Can you replicate the problem on a new project?

Michael Taylor - 2/24/09
http://p3net.mvps.org

Chargeback on Mon, 09 Mar 2009 23:10:54


I am sorry it took so long to respond.  For many days I would click the link to display my threads and it displayed empty.  I started a new project today.  It is a normal c# windows form application.  I worked in it for several hours making changes.  The changes were reflected when debugging.  I am a programmer/hack/whatever that makes a small change and clicks debug to check the results.  I must have made over 50 changes today with all of them immediately being reflected when I debug.   Then all of a sudden changes started to not be reflected when I debug.  I checked Solutions\Build and the settings are correct.  There are no build errors.  I have not made changes to the Debug settings.  I checked and SP1 is applied.  And unfortunately I have now replicated the issue on this new project.  One added note...  I am working on the computer via remote desktop.  I have tried console mode with same results.  Computer is in another state so I cannot try locally.  I appreciate the suggestions so far and if there are any other ideas to try please let me know.  I appreciate it.  Thank-you.    

CoolDadTx on Wed, 11 Mar 2009 13:26:27


I don't understand why you would want to use Remote Desktop.  If you are using RD so multiple users can share the same install of VS to avoid buying multiple copies then I'm afraid you are in violation of the licensing terms.  VS is licensed per user.  Since it is licensed per user you should install it on your primary machine instead.  If you need RD strictly for debugging against a specific server then you should use remote debugging instead.

I'm not sure if RD is causing the problems or not.  I can't really think of any reason why it would but if you could eliminate that factor then it would help narrow it down.

Follow up question.  If you close the (new) project and VS and then reopen and start debugging again, does it work?  If you are using RD are there other users trying to work against the same project? 

Michael Taylor - 3/11/09
http://p3net.mvps.org

bodwinestroll on Sat, 21 Jul 2012 10:14:27


I have dont al that and i seem to still have the same problem please help out. It displays correctly when i use the release command but not in debug mode

CoolDadTx on Sat, 21 Jul 2012 20:07:18


Please do not use an existing thread to report your issues.  Create your own thread with the details of your problem.