Enabling Debug and Trace Output

To use the Debug class, the DEBUG flag must be defined, or else the methods of this class will not be compiled into the executable or library. Similarly, to use the Trace class, the TRACE flag must be defined. This way you can have different diagnostics for release and debug builds. Bring up the project property pages from the menu Project | Properties. Choose Build under Configuration Properties. You can then check or uncheck the DEBUG and TRACE conditional compilation constants, as shown in Figure B-1.

Figure A-1. Visual Studio window for setting conditional compilation constants.

Get Application Development Using Visual Basic® and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.