The System.Diagnostics.Debug class only works with Debug build configurations and does not take effect when you build the application for Release.
The following is an example of how to utilize the WriteLine method of the System.Diagnostics.Debug class:
program-id. Program1. data division. working-storage section. 01 var pic x. procedure division. invoke type System.Diagnostics.Debug::WriteLine("Hello World") accept var. goback. end program Program1.
The WriteLine method is declared with a conditional attribute, ConditionalAttribute("DEBUG") which means the application only invokes the method if you set the DEBUG constant for your project, and then build the project for Debug.
The application writes the debug information in the Output window.
If you do not set the Debug constant, or if you build the project for Release, the application ignores the method and does not write any debug information in the Output window during execution.
For more information on how to use the System.Diagnostics.Debug class, go to the MSDN.