Overview of Debugging .NET COBOL

Visual COBOL uses the Visual Studio debug engine for debugging .NET COBOL applications.

Microsoft have included an enhanced .NET debug engine in recent versions of Visual Studio. Visual COBOL supports this new engine for .NET COBOL from Visual Studio 2017.

The older Visual Studio debug engine is still used with Visual COBOL for versions of Visual Studio 2015 and earlier.

Note: Known issues:
  • Queries of object references may fail unless the source code is recompiled.

Features of the enhanced .NET debugger

The new .NET debug engine in Visual Studio provides a number of features to use while debugging .NET COBOL such as:

  • .NET backwards debugging - records and traces the application's execution with the help of the IntelliTrace feature.
    Note: Check the Visual Studio software requirements for this feature.
  • .NET remote debugging - enables you to debug .NET COBOL applications deployed on a different machine.
  • Diagnostics Tools window - provides more details on performance, IntelliTrace, as well as CPU and memory usage.
  • An expression evaluator for COBOL:
    • Complex expressions that include object references, object::[Property][Method].

      For example: type System.Environment::GetEnvironmentVariable("PATH")::Split(';').

    • Intrinsic expressions such as $ReturnValue or $exception.
  • Improved integration when using other .NET languages (such as C# or Visual Basic).
  • IntelliSense suggestions inside the debugger windows (Watch, Quick Watch, and Immediate).
  • Object tracking using Make Object Id.
  • Performance tips (PerfTips) - provide time-elapsed tips after the execution of every statement.
  • Presenting occurs and group items in the same manner as by the COBOL native debugger.
  • Objects are now represented in the same manner as C# or VB. Any COBOL-specific data format items are listed under an expansion node named COBOL data.
  • Enhancements to the HEX view.

The new Visual Studio debug engine integrates directly with the COBOL compiler. This enables you to specify any valid COBOL expression to be specified when debugging. Visual Studio reports errors just the same as if the expression was coded directly in the COBOL source.

Switching to Managed Compatibility Mode

You can switch to using the older .NET debug engine as follows:

  1. In Visual Studio, click Debug > Options > General.
  2. Check Use Managed Compatibility Mode.
Note: Switching to the old engine disables some of the features that are only available in the newer Visual Studio debug engine.