Most of the information in this topic is also included elsewhere in the documentation in topics that describe debugging containerized COBOL applications in general. It is summarized here for your convenience.
The ability to debug a .NET COBOL application running in a container relies on remote debugging functionality provided by Microsoft Remote Tools, so when you are building an image that will be used for this purpose you must ensure that the image includes the following additional files:
If you do not already have VS_RemoteTools.exe you can download it from the Microsoft site (see Microsoft: Remote Debugging a C# or Visual Basic project in Visual Studio) or use a Powershell command as shown in the bld.bat file for the Build_HelloWorld Docker demonstration.
Typical commands that you could include in a Dockerfile to perform these steps are as follows:
COPY VS_RemoteTools.exe "${APPDIR}\\" RUN VS_RemoteTools.exe /install /quiet /norestart && \ del VS_RemoteTools.exe && \ setx /M PATH "%PATH%;C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\Common7\\IDE\\Remote Debugger\\x64" ... CMD msvsmon.exe /nostatus /silent /noauth /anyuser /nosecuritywarn
For more information on Microsoft's remote debugging see Microsoft: Remote Debugging a C# or Visual Basic project in Visual Studio. Although that article refers to C# and Visual Basic, those languages use remote debugging in much the same way as does .NET COBOL.
A typical command that you could include in a Dockerfile to do this is as follows:
COPY [ "%Program Files%\Microsoft Visual Studio\2022\Professional\Common 7\IDE\Remote Debugger\x64\MicroFocus.COBOL.ExpressionEvaluator.Remote.dll" , "\Program Files\Microsoft Visual Studio 15.0\Common7\IDE\Remote Debugger\x64" ]
Micro Focus recommends that you install the .NET COBOL support only into images containing .NET COBOL applications that you need to debug. Doing this avoids installing the support into images where it would not be used but would still take up disk space and other resources.
Alternatively you could create a .NET COBOL-specific version of the Visual COBOL base image. To do this you would use the Visual COBOL base image as a starting point and add the .NET COBOL support into it. Using this approach would give you one Visual COBOL image to use for debugging native COBOL applications and a different Visual COBOL image to use for debugging .NET COBOL applications.
When starting an image containing a .NET COBOL application to be debugged you do the same as you would as if the application was native but with the following differences:
e.g. Default entrypoint in container, overriding entrypoint on Docker Run, triggering via Docker exec etc.
The easiest way to achieve this is to volume mount the top level folder which you could do with a docker run command option such as the following:
-v C:\ManagedCOBOLApp:C:\ManagedCOBOLApp
When using the Attach to Process option to connect to a container that is running a .NET COBOL application, the process is the same as for when the application is native but with the following difference: