Reputation: 545
I'm trying to debug a C# application, and I've defined some debug-only code within #if DEBUG/#endif blocks, and despite setting the build to Debug and double-checking the project properties and ensuring it's set to output to Debug and that the "Define DEBUG constant" checkbox is checked, my code isn't running. This is what I'm trying to do:
#if DEBUG
log.Add("Executing this section of code.");
#endif
and also
#if DEBUG
SkipToThisOtherMethod();
return;
#endif
It's blowing right past without running that code. What am I doing wrong??
Upvotes: 1
Views: 1362
Reputation: 1678
I had this problem and seemed to resolve it by un-ticking the Define DEBUG Constant, saving the project, re-ticked it and saved the project again. Then Build and run and the #if DEBUG and #if !DEBUG sections went back to working normally.
Upvotes: 1