Solved

Visual Studio 2015 locks debug executable

Posted on 2016-07-16
9
106 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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 32

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

758 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