Narity Reporterpreview

Troubleshooting

Fix CrystalDecisions assembly load errors.

Most of these errors have one of three causes: the SAP runtime is missing, the versions do not match, or the process has the wrong bitness.

"The system cannot find the file specified"

The message has this form:

Could not load file or assembly 'CrystalDecisions.…, Version=13.0.…,
Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies.
The system cannot find the file specified.

The application references Crystal Reports for Visual Studio assemblies that the computer does not have. Check these causes in order:

  1. The runtime is not installed. Install the Crystal Reports runtime MSI on the server as a local administrator. Get it from SAP's Crystal Reports for Visual Studio downloads page.
  2. The assemblies were copied to the bin folder. An SAP Community answer says: "Do not copy them onto the APP server, they should be installed with the MSI and GAC'd only". Set Copy Local to False on the CrystalDecisions references.
  3. The service packs differ. Build with the same service pack that the server runs. The same answer says: "You cannot mix SP 1 and SP 23 in the same app, it needs to be recompiled". Then make the versions in web.config or app.config match the installed assemblies.

SAP's supported platforms document says that only the latest support package is supported. The latest is Service Pack 40. The generic "Load report failed" error can have the same service pack mismatch as its cause.

"An attempt was made to load a program with an incorrect format"

This is a BadImageFormatException. A 32-bit process loads a 64-bit assembly, or a 64-bit process loads a 32-bit one.

The runtime bitness must match the application process, not the operating system. An SAP Community answer says: "specify the platform in the project and don't use AnyCPU."

  • Desktop applications: set the project platform to x64. An AnyCPU executable with "Prefer 32-bit" runs as a 32-bit process.
  • IIS applications: set Enable 32-Bit Applications to False on the application pool.
  • Database drivers: use 64-bit drivers in a 64-bit process.

Use the 64-bit runtime. SAP's maintenance dates page says that the 32-bit runtime is not supported after December 31, 2025. See Crystal Reports end-of-support dates.

The ReportDocument type initializer threw an exception

The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument'
threw an exception.

The runtime failed while it loaded. Read the inner exception. It names the assembly that failed to load.

A frequent cause is a bitness mismatch. An SAP Community answer says that this error usually appears "when you compiled in 32 bit and installed the 64 bit runtime or compiled in 64 bit and installed the 32 bit runtime." Apply the bitness fixes.

crdb_adoplus.dll fails to load

The message names a file path that ends in:

…\win32_x86\dotnet1\crdb_adoplus.dll

The ADO.NET driver in older service packs was built for .NET 2.0, and .NET Framework 4 does not load it by default.

Install the latest service pack. SAP's downloads page says that the workaround is no longer required from Service Pack 21. On an older service pack, add this element to app.config:

<startup useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0" />
</startup>

Errors on .NET Core, .NET 5, and later

A reference to CrystalDecisions from a modern .NET application fails with errors such as:

System.TypeLoadException: Could not load type 'System.Web.UI.Control'
from assembly 'System.Web, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'.

No configuration change fixes this. Crystal Reports for Visual Studio supports .NET Framework 4.5.2 to 4.8 only. Section D of SAP's Crystal Solutions FAQ says: "There are NO plans to update to Framework higher than 4.8, at this point."

You have two options:

  • Keep the reporting code in a separate .NET Framework process on Windows.
  • Render the same .rpt files on .NET 10 with Narity Reporter. It reads the files directly and needs no SAP runtime. It uses its own API, so you change the code that loads and renders reports. It is in preview, so compare its PDFs with your Crystal output first.

The migration guide maps each part of the integration to the Narity Reporter API.