ArcGIS Engine applications can return Runtime Error R6034 message at versions 10.4 and 10.4.1. This error may occur opening an .mxd file or refreshing a layer with a Python labelling expression. The full message appears as follows:
Error: "Microsoft Visual C++ Runtime Library" Runtime Error! Program: C... R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information.
Note: This issue also affects ArcEngine version 10.4.1 for the .NET framework
This error message occurs when the application encounters duplicate copies of the Microsoft C Runtime Library version 9, msvcr90.dll. The duplicate copy is typically exposed to the application when a folder with a copy of msvcr90.dll exists in the PATH environment variable.
Viewing maps or layers with Python labeling expressions, opening the Python window, and working with geoprocessing tools can all cause Python to load, which can trigger loading the incorrect Microsoft C Runtime Library version 9, msvcr90.dll. The msvcr90.dll C runtime library is installed and used by many third-party programs. If their install and configuration adds the program’s folder to the PATH environment variable, the machine can trigger this issue in ArcGIS. Cases reported to Esri show that this configuration is sometimes seen with two widely used software packages: LANDesk (C:\Program Files (x86)\LANDesk\Shared Files) and the Intel Management Engine’s iCLS component (C:\Program Files (x86)\Intel\iCLS Client\).
An application manifest should be added to the Engine application to ensure the correct msvcr90.dll (required by Python) is loaded. In Visual Studio, Add New Item > Application Manifest File (app.manifest). Add the following XML into the app.manifest:
<?xml version="1.0" encoding="utf-8"?> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyIdentity ..../> <trustInfo .../> <compatibility .../> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.vc90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"/> </dependentAssembly> </dependency> </assembly>
This ensures that the correct msvcr90.dll is loaded by the Engine application. Compile and test the application.
Note: Esri does not recommend workarounds that involve modifying the PATH environment variable or deleting msvcr90.dll from folders listed in the PATH, as doing either can negatively impact any application reliant on the DLL.