A "COMException" exception causes a .NET Framework 3.5 SP1-based WPF application to crash if the application loads and unloads the application domains frequently

Applies to: .NET Framework 3.5 Service Pack 1


Consider the following scenario:
  • You run a Microsoft .NET Framework 3.5 Service Pack 1 (SP1)-based Windows Presentation Foundation (WPF) application.  
  • The WPF application uses the hardware rendering pipeline.
  • The application loads and unloads many application domains that contain one or more custom WPF add-in components.
In this scenario, the application encounters a System.Runtime.InteropServices.COMException exception, and then the application crashes.


Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

To download this hotfix from the MSDN Code Gallery, visit the following Microsoft website:

Note The MSDN Code Gallery displays the languages for which the hotfix is available. If you do not see your language listed, it is because the Code Gallery resource page is not available for that language.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website:


To apply this hotfix, you must have the .NET Framework 3.5 Service Pack 1 (SP1) installed. 

Restart requirement

You do not have to restart the computer after you apply this hotfix.

Hotfix replacement information

This hotfix does not replace any other hotfix.

File Information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

For all supported x86-based versions of Windows Server 2003 and of Windows XP
File nameFile versionFile sizeDateTimePlatform
For all supported x64-based versions of Windows Server 2003 and of Windows XP
File nameFile versionFile sizeDateTimePlatform
For all supported x86-based versions of Windows Vista Service Pack 2 (SP2) and of Windows Server 2008 Service Pack 2 (SP2)
File nameFile versionFile sizeDateTimePlatform
Presentationfontcache.exe.configNot Applicable16103-Apr-200921:25Not Applicable
For all supported x64-based versions of Windows Vista SP2 and of Windows Server 2008 SP2
File nameFile versionFile sizeDateTimePlatform
Presentationfontcache.exe.configNot Applicable16103-Apr-200920:58Not Applicable
For all supported x86-based version of Windows 7
File nameFile versionFile sizeDateTimePlatform
Presentationfontcache.exe.configNot Applicable16110-Jun-200921:14Not Applicable
For all supported x64-based versions of Windows 7 and of Windows Server 2008 R2
File nameFile versionFile sizeDateTimePlatform
Presentationfontcache.exe.configNot Applicable16110-Jun-200920:30Not Applicable


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.


To work around this issue, disable the hardware rendering pipeline, and then enable the software rendering pipeline.

To disable the hardware rendering pipeline, and to enable the software rendering pipeline, use one of the following methods:
  • Set the System.Windows.Interop.RenderMode enumeration.

    The following is some example code that sets the System.Windows.Interop.RenderMode enumeration to enable the software rendering pipeline when a WPF window is loaded:
    private void OnLoaded(object sender, EventArgs e)
    System.Windows.Interop.HwndSource hwndSource = PresentationSource.FromVisual(this) as System.Windows.Interop.HwndSource;
    System.Windows.Interop.HwndTarget hwndTarget = hwndSource.CompositionTarget;

    hwndTarget.RenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
  • Set the DisableHWAcceleration registry key.

    Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
    322756 How to back up and restore the registry in Windows

    Warning This method disables hardware rendering pipeline for all WPF applications on the computer. Therefore, the method is not encouraged usually except when the customers control the environments and do not mind the effect for all WPF applications.

    1. Click Start, click Run, type regedit, and then press ENTER.
    2. Locate and then click the following registry subkey:
    3. Set the value of the DisableHWAcceleration registry entry to 1.

      Note If the DisableHWAcceleration registry entry does not exist, right-click the registry subkey, point to New, and then click String Value to create a new registry entry. Type DisableHWAcceleration for the name of the new registry entry, double-click DisableHWAcceleration, and then change the DisableHWAcceleration value data to 1.
    4. Exit Registry Editor.

More Information

For more information about the software rendering pipeline, visit the following Microsoft Developer Network (MSDN) website:

General information about the software rendering pipeline

For more information about the registry settings of WPF rendering, visit the following MSDN website:

General information about the registry settings of WPF rendering

For more information about the System.Windows.Interop.RenderMode enumeration, visit the following MSDN website:

General information about the "System.Windows.Interop.RenderMode" enumeration