Reputation: 1217
I'm testing a Visual Studio C# program mostly in debug mode with breakpoints. Sometimes I need to build the release version .exe to run some tests, but then go back to testing in debug mode.
Before I build the release version I'm not removing my breakpoints. Is there any reason to remove the breakpoints? Does anything carry over to the release exe? I don't see anything, but i just want to be sure.
Thanks!
Upvotes: 3
Views: 861
Reputation: 8725
Back in the good old days, you could have an INT 3
machine instruction in the binary code of exe and dll files, which is the assembly definition of a breakpoint and would (and still will) cause to break into a debugger. No .NET compiler/linker does that. Actually, it cannot - because managed exe files contain IL which is just-in-time compiled.
In .NET and especially in the Microsoft environment, breakpoints are a feature of the IDE in connection with
the runtime, and never end up in the binary.
An old, but thorough writeup of the mechanism of managed breakpoints can be found here: https://blogs.msdn.microsoft.com/jmstall/2004/12/28/how-do-managed-breakpoints-work/
Breakpoints are stored in a configuration file of the VS solution only for convenience (so developers would not lose their breakpoitns between Visual Studio sessions).
In contrast, a Debug.Assert
call can cause harm in release builds, if used or configured incorrectly.
Upvotes: 3