.NET Known Issues and Restrictions

The following sections describe limitations that apply when using Visual COBOL to create applications for use with .NET.

.NET Version

Visual COBOL enables you to create COBOL applications to be deployed for use with .NET 6.

COBOL Language

A COBOL application that is to be deployed to .NET cannot include any of the following features:

  • ACUCOBOL-GT file handling
  • CBL_THREAD_KILL library routine
  • ILVERIFY(CHECK) Compiler directive option
  • JSON PARSE statement
  • STOP RUN statement in secondary threads
  • XML preprocessor or XML Extensions (although the XML PARSE and XML GENERATE statements can be used)

COBOL Run-time Configuration

If you need to use an application configuration file to configure the run-time behavior of an application that will be deployed to .NET, the configuration file must be a .dll.config file instead of a .exe.config file as it would be for .NET Framework console application.

Database Access

  • If a COBOL application that is to be deployed to .NET 6 needs to use an OpenESQL CONNECT statement, it must use format 6 of the CONNECT statement. See CONNECT for more information.
  • The SQL(DBMAN=ODBC) directive cannot be used in a .NET 6 COBOL SQL program. You must use SQL(DBMAN=ADO).

Native and .NET File Handler

By default, COBOL applications in .NET projects use the native file handler for their file handling operations. In order for the native file handling functionality to be available when the project is deployed and run, when you publish a .NET project the published files include the required native run-time system and file handler (as part of the MicroFocus.COBOL.Runtime package).

If you will be debugging a local .NET application on Windows where the main program is not COBOL, for example the main program is C#, you must ensure that an appropriate file handler is used. Failure to do so will result in run-time system error COBRT198 ("Load failure") on the first COBOL file I/O statement.

By default the 32-bit native version of the file handler will be available. For this to be used by your application you need to make sure the project for the main program is built to target the x86 platform.

Alternatively, to avoid any dependency on the native run-time system you can use the .NET file handler. You can switch a .NET project to use the .NET file handler rather than the native file handler by specifying the directives CALLFH(EXTFH) and CALLSORT(EXTSM) in the project.

Deploying to Azure .NET

By default, COBOL applications in .NET projects use the native file handler for their file handling operations. In order for the native file handling functionality to be available when the project is deployed and run, when you publish a .NET project the published files include the required native run-time system and file handler (as part of the MicroFocus.COBOL.Runtime package).

If you will be deploying a .NET project to an Azure .NET environment you should instead use the .NET file handler in the project to avoid dependencies that would also require the native C runtime to be deployed by the project. You can switch a .NET project to use the .NET file handler rather than the native file handler by specifying the directives CALLFH(EXTFH) and CALLSORT(EXTSM) in the project.

global.json File

Visual Studio 2022 requires that the global.json file of .NET 6 projects is placed at the directory level of the solution file in order for the project to successfully open and build. In previous versions of Visual Studio, the file could be located in subfolders of the solution such as in the project folder.

This can affect existing .NET Core 3.1 COBOL projects that you upgrade from a prior release if the global.json file is not at the directory level of the solution file. It also affects .NET 6 COBOL projects that you add to an existing solution.

In these cases, you might receive the following error message if building from the MSBuild command line, or in the IDE Output window if the project fails to load:

"The SDK 'MicroFocus.Sdk' specified could not be found"

To work around this issue, you need to move the global.json file to the directory level of the solution file.

New .NET 6 COBOL solutions and projects created with VS2022 create the global.json file in the required location.

Operating Systems

The following table shows the architectures and the operating systems to which you can deploy .NET-targeted COBOL applications that you have published using Visual COBOL. The supported versions of the operating systems are the ones that Visual COBOL supports:

Operating System Architecture
Red Hat Enterprise Linux x64
SUSE Enterprise Linux x64
Ubuntu x64
CentOS x64
Windows Client x64
x86
Windows Server x64
x86
Note:

The following operating systems are supported by .NET but cannot be used for the deployment of COBOL applications:

  • MacOS
  • Windows containers running under Docker

Visual COBOL Build Tools for Windows

To be able to use Visual COBOL Build Tools for Windows to build .NET projects you must be using Microsoft's Build Tools for Visual Studio 2022. For more information see Using Visual COBOL Build Tools for Windows to Build .NET Projects.

Visual Studio Version

Because Visual COBOL requires .NET version 6 and .NET version 6 is not supported by Visual Studio 2017 and Visual Studio 2019, you must be using Visual Studio 2022 or later to be able to use Visual COBOL to create COBOL applications to be deployed for use with .NET.

Using Visual COBOL for Visual Studio 2017 or 2019 to open a .NET-enabled project from a previous version of Visual COBOL results in an error informing you that the project cannot be opened.

Windows Forms Designer

It is not possible to use the Windows Forms Designer with projects created using the Windows Forms App (.NET) project template.