Subscribe

UiPath Studio

The UiPath Studio Guide

The "TypeInitializationException" or "FileFormatException" Error in WPF Applications

Cause

The "TypeInitializationException" or "FileFormatException" errors are caused by the installer’s interaction between the .NET Framework January 2018 Rollup (KB 4055002) and an already installed version of the .NET Framework 4.7.1. The 4.7.1 version of the GlobalUserInterface.CompositeFont file is overwritten during the January 2018 Rollup installation.

The KB 4055002 update issued by Microsoft for Windows 7 and Windows Server 2008 R2 SP1 is also known to cause unexpected crashes after installing UiPath. The fix was done by re-releasing the January 2018 Monthly Rollup as KB 4074880.

This also happens if you have the KB 4074906 update installed, as the corrupt GlobalUserInterface.CompositeFont file from the KB 4055002 update is not overwritten, which causes the errors.

Known to Affect

The known issue affects computers running Windows 7 and Windows Server 2008 R2 SP1. It manifests if the following components are installed:

  1. .NET Framework 4.7.1 and .NET Framework January 2018 Security and Quality Rollup (KB 4055002) installed on computers with the KB 4074906 update.
  2. The KB 4074906 update installed but without having run the FixIt tool.

Symptoms

396

Errors can be encountered when a Windows Presentation Foundation (WPF) application requests a fallback font or a character that is not included in the currently selected font. This makes Studio fail to start. One of the following error messages can be encountered:

  • System.TypeInitializationException: The type initializer for ‘System.Windows.Media.Fonts’ threw an exception.
  • System.IO.FileFormatException: No FontFamily element found in FontFamilyCollection that matches current OS or greater: Windows7SP1.
  • System.IO.FileFormatException: No FontFamily element found in FontFamilyCollection that matches current OS or greater: Windows7SP1.

Solutions

Running the Fixit Tool for KB 4074906

The Microsoft FixIt tool replaces the corrupt GlobalUserInterface.CompositeFont file from the KB 4055002 with the correct one from the KB 4074906 update.

The Microsoft FixIt tool for the KB 4074906 update is included in the Windows Update KB 4074906 or it can be downloaded by clicking here.

684

The fix is applied by replacing the corrupt font file with the correct version. If you run the fixittool-KB4074906.exe file, consider the following:

  1. Close any running applications.
  2. Run the file from a Command Prompt instance with Administrator privileges.
  3. Run your applications again. The issue is no longer encountered.

📘

Note:

The Fixit tool is meant to be used on affected systems with the KB 4074906 update installed.

If you want to determine the return code, you can use the following commands:

C:\KB4074906>start /wait FixItTool-KB4074906.exe
C:\KB4074906>echo %errorlevel%

The tool outputs the following error codes:

CaseCode
Success0
Copy Error2
File in Use33
Generic Error1603
NotApplicable20160

Re-installing the January 2018 Monthly Rollup

The new version of the January 2018 Monthly Rollup has been released to include a fix for this known issue. Affected systems can be fixed by uninstalling the broken update KB 4055002 and then installing the updated January 2018 Monthly Rollup (KB 4074880).

Here is the step-by-step procedure of re-installing the update:

  1. Access the Control Panel.
  2. Search for Windows Updates.
  3. Under Programs and Features, click the View installed updates link.
  4. Search for the KB 4055002 update under the Security and Quality Rollup for Microsoft .NET Framework 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1 section.
  5. Select the update and click Uninstall. A confirmation pop-up is displayed.
  6. Press Yes in the confirmation window.
  7. Restart your computer.
  8. Download and install the following components:
  9. Follow the installation steps.
  10. Restart your computer.

Manually replacing the corrupt file

Manually replacing the corrupt file also works and can be done by following these steps:

  1. Download the GlobalUserInterface.CompositeFont file.
  2. Replace the corrupt file using one of the following methods:
    2.1.1. Open a Command Prompt instance with Administrator privileges.
    2.1.2. Navigate to the following location using this command cd %windir%\Microsoft.NET\Framework\v4.0.30319\WPF\Fonts.
    2.1.3. Run this command xcopy /y %USERPROFILE%\Downloads\GlobalUserInterface.CompositeFont.

📘

Note:

%USERPROFILE%\Downloads is the default download location for Windows 7. If it is different, replace %USERPROFILE%\Downloads with the location of the file downloaded at step 1.

2.2.1. Copy the downloaded file.
2.2.2. Open a File Explorer window.
2.2.3. Navigate to this %windir%\Microsoft.NET\Framework\v4.0.30319\WPF\Fonts location.
2.2.4. Paste the file and accept the overwrite prompt.

📘

Note:

This also needs to be done for x64 architectures. The procedure is the same. All you have to do is to paste the file in this %windir%\Microsoft.NET\Framework64\v4.0.30319\WPF\Fonts location.

  1. Restart your computer.

All .NET Framework programs affected by this issues now properly function.

Updated 2 years ago

The "TypeInitializationException" or "FileFormatException" Error in WPF Applications


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.