New to Telerik Reporting? Download free 30-day trial

Resolving Object Reference Error with Telerik.Reporting.Drawing.FontExtensions.ToEngineFont in .NET on Alpine Docker



Product Progress® Telerik® Reporting
OS Linux Alpine
Target Framework .NET


When deploying a .NET application to an Alpine Docker Container Image running on Kubernetes, the following error occurs during report rendering. This issue is related to the application's inability to resolve fonts correctly within the Alpine environment.

Error Message

System.NullReferenceException: Object reference not set to an instance of an object at Telerik.Reporting.Drawing.FontExtensions.ToEngineFont(IFont font) ...


The error is caused by the absence of necessary fonts in the Alpine Docker image. Since the application cannot find any fonts, it results in a NullReferenceException when attempting to process fonts using Telerik.Reporting.Drawing.FontExtensions.ToEngineFont.


To fix this issue, install the fonts used by your reports to your Alpine Docker container. You can install any supported TrueType font (see Fonts Requirements) but if a report uses a different font, it will be substituted with whatever is available. For example, you can install the commonly used Microsoft TrueType fonts using the commands below.

apk update
apk upgrade
apk add freetype
apk add fontconfig
apk add msttcorefonts-installer
fc-cache -f

These commands update the package list, upgrade existing packages, and install FreeType and font configuration tools. It also installs Microsoft's core TrueType fonts and updates the font cache, ensuring that the application can resolve fonts correctly.

See Also

In this article