DEBUG Preprocessor Symbol

Enable the DEBUG preprocessor symbol if you want to add code to your application to help you debug while testing the application.

This is a selection on the General tab of the Project painter. Although you do not typically enable the DEBUG symbol in a release build, if a problem is reported in a production application, you can redeploy the release build with the DEBUG symbol enabled to help determine the nature or location of the problem.

When the DEBUG symbol is enabled, code that is enclosed in a code block with the following format is parsed by the pb2cs code emitter:
#if defined DEBUG then
   /*debugging code*/
#else
   /* other action*/
#end if
Note:

When you use the DEBUG symbol, you can add breakpoints in the DEBUG block only for lines of code that are not in an ELSE clause that removes the DEBUG condition. If you attempt to add a breakpoint in the ELSE clause, the debugger automatically switches the breakpoint to the last line of the clause defining the DEBUG condition.

In the previous pseudocode example, if you add a breakpoint to the comment line “/* other action*/”, the breakpoint automatically switches to the “/*debugging code*/” comment line.

This figure shows the context menu item that you can use to paste the #If Defined DEBUG Then template statement in the Script view:


The Paste Special cascading menu displays the Preprocessor menu item that opens a cascading submenu. The submenu includes the #If Defined DEBUG Then statement.

For information about using preprocessor symbols such as DEBUG, see Conditional Compilation.