Solved

Visual Studio 2015 locks debug executable

Posted on 2016-07-16
9
134 Views
Last Modified: 2016-07-18
Microsoft's Visual Studio Professional 2015 has a nasty tendency to lock the executable in debug and refuse to recompile. This happens whenever any change is made in source code (C++ console programs) while at a breakpoint in debug. Sometimes closing Visual Studio and restarting is enough. More often, I have to restart the computer.

Is there any setting in Visual Studio that has a bearing on this behavior? Is there a way to stop it, short of paying $399 for an incident report to Microsoft?
0
Comment
Question by:StMike38
9 Comments
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 41715796
This can happen while debugging if you open a resource such as a file on the file system and the program is terminated for some reason before closing the resource. See if that is happening in your case.
0
 

Author Comment

by:StMike38
ID: 41716003
Making any change in one of the .cpp source files triggers the locking. In earlier versions of Visual Studio it was possible (and very convenient) to type in changes while still able to refer to memory, watch, and other debug files. Visual Studio 2015 is behaving differently. Did Microsoft really intend to lock the executable and force a reboot? Surely there is some way around this.
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 41716036
So are you saying that starting Visual Studio opening a project then modifying a source file and then compiling the project without doing anything else will cause the issue? Is that correct?
0
 

Author Comment

by:StMike38
ID: 41716044
The key point: The phenomenon occurs only when in debug and stopped at at a breakpoint. If (while still in debug), one changes a single keystroke in any source file, the locking feature kicks in.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 62

Expert Comment

by:Fernando Soto
ID: 41716046
To my first post has the program have a resource such as a file open?
0
 

Author Comment

by:StMike38
ID: 41716089
Just ran a test. No programs open except Visual Studio 2015. Ran in debug a console program with multiple .cpp source, but only one source file open. Ran to a breakpoint. Typed a few keystrokes near the breakpoint line in the code. Ran the compile. Message "fatal error LNK1168: cannot open E:\Data\epub\EpubHdgs\Debug\EpubHdgs.exe for writing". In other words, no files were open except the one source code.
0
 
LVL 22

Accepted Solution

by:
ambience earned 500 total points
ID: 41717079
When the executable is open for debugging it cannot be overwritten, which is what the LINKER is complaining about. This is pretty normal, when you try the regular build. I maybe forgetting but you can edit and just continue debugging and the code change will be applied automatically.

What you are trying to do should be covered by the Edit & Continue settings. See if thats enabled in the Settings. I think Deubg -> Options & Settings is the place to check.

https://msdn.microsoft.com/query/dev12.query?appId=Dev12IDEF1&l=EN-US&k=k(VS.ToolsOptionsPages.Debugger.ENC)&rd=true
0
 
LVL 33

Expert Comment

by:sarabande
ID: 41717119
This is pretty normal, when you try the regular build.

i don't think it is normal. normally, - if edit and continue was not enabled - the Debugger asks whether you want to stop the program to be debugged. then you only have the choice to continue (with the new code ignored) or to stop and build.

if edit and continue was enabled you have to proceed with f5 or f10 to invoke the internal compiler.

you cant' use compile or build from build menu while debugging.

i assume the executable you were debugging is not the output target of your project build. that would explain why the build was started while you were debugging without getting asked before.

Sara
1
 

Author Closing Comment

by:StMike38
ID: 41717319
Locking diminished considerably with "Enable Edit and Continue" checked. I took the further step of unchecking the sub box  "Apply changes on continue". With those two changes, I have had no recurrence of locking.

Many thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
A short article about problems I had with the new location API and permissions in Marshmallow
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now