Microsoft Edge Try Microsoft Edge A fast and secure browser that's designed for Windows 10 Get started

Skip to main content
Microsoft
Microsoft Support
  • Office
  • Windows
  • Surface
  • Xbox
  • Deals
  • Support
      • Windows apps
      • OneDrive
      • Outlook
      • Skype
      • OneNote
      • PCs & tablets
      • Accessories
      • VR & mixed reality
      • Microsoft HoloLens
      • Xbox games
      • PC games
      • Windows digital games
      • Movies & TV
      • Microsoft Azure
      • Microsoft Dynamics 365
      • Microsoft 365
      • Cloud platform
      • Enterprise solutions
      • Data platform
      • .NET
      • Visual Studio
      • Windows Dev Center
      • Docs
      • Free downloads & security
      • Education
      • Store locations
      • Gift cards
    • View all
    0
    Sign in
    Microsoft Support

    "COMException" error from WPF applications after the .NET Framework 4.7 is installed on Windows 7 or Windows Server 2008 R2

    Content provided by Microsoft

    Content provided by Microsoft

    Applies to: Microsoft .NET Framework 4.7Windows 7 Service Pack 1Windows Server 2008 R2 Service Pack 1


    Symptoms


    Consider the following scenario:

    • You have a touch device that is running Windows 7 Service Pack 1 (SP1) or Windows Server 2008 R2 SP1.
    • Some Windows Presentation Framework (WPF) applications are running on the device.
    • You install the May 2017 Preview of Quality Rollup for the .NET Framework 4.6, 4.6.1, and 4.6.2 (KB 4104606) on the device.
    • You then install the .NET Framework 4.7 on the device.

    In this scenario, the WPF applications fail and generate error messages that resemble the following message:

    Exception type:   System.TypeInitializationException
    Message:   The type initializer for 'MS.Win32.Penimc.UnsafeNativeMethods' threw an exception.
    InnerException:   System.Runtime.InteropServices.COMException
    Message of the inner exception: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
     

    Resolution


    To resolve this problem, install the July 25, 2017, update for the .NET Framework 4.6, 4.6.1, 4.6.2, and 4.7 from the Microsoft Update Catalog.

    Windows 7 SP1 and Windows Server 2008 R2 SP1

    Download the stand-alone package from the Microsoft Update catalog. For more information about this update, see KB 4035510.

    Windows 8.1 and Windows Server 2012 R2

    Download the stand-alone package from the Microsoft Update catalog. For more information about this update, see KB 4035509.

    Windows Server 2012

    Download the stand-alone package from the Microsoft Update catalog. For more information about this update, see KB 4035508.

    Workaround


    To work around this problem, uninstall and then reinstall the .NET Framework 4.7. Alternatively, temporarily disable the affected WPF touch component.

    Uninstall the .NET Framework 4.7

    1. In Control Panel, click Uninstall a program in the Programs category.
    2. In the list of programs, locate and click Microsoft .NET Framework 4.7, and then click Uninstall/Change.
    3. In the .NET Framework 4.7 Maintenance wizard, click Remove.NET Framework 4.7 from this computer, and then click Next.
    4. If the following warning window appears, click Continue.

      Warning at uninstalling .NET Framework 4.7
    5. Wait for the uninstallation to complete.

    Reinstall the .NET Framework 4.7

    To reinstall the Microsoft .NET Framework 4.7, use one of the following methods.

    Method 1: Manually download and install the .NET Framework 4.7

    1. Download the web installer for the .NET Framework 4.7.
    2. Install the .NET Framework 4.7.

    Method 2: Use Windows Update to install the .NET Framework 4.7

    1. Open Windows Update.
    2. Click Check online for updates from Windows Update.
    3. After the search for updates is complete, click Optional Updates available.

      Optional Updates available
    4. Locate and select Microsoft .NET Framework for Windows 7 and Windows Server 2008 R2, and then click OK.

      .NET Framework 4.7 in Windows Update
    5. Wait for the installation to complete.

    Temporarily disable touch and stylus support for your WPF applications

    To temporarily disable touch and stylus support, use one of the following methods.

    Note See the "Status" section of this article for information about a permanent solution.

    • Add the following entry to the application configuration to disable touch and stylus support for WPF applications.

    <runtime>

    <AppContextSwitchOverrides value=" Switch.System.Windows.Input.Stylus.DisableStylusAndTouchSupport=true"/>

    </runtime>

    • Apply the following registry subkey to disable touch and stylus support for WPF applications machine-global.

      Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall the operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.


      Registry location: HKEY_LOCAL_MACHINE\Software\[Wow6432Node\]Microsoft\.NETFramework\AppContext\Switch.System.Windows.Input.Stylus.DisableStylusAndTouchSupport
       

      Type: String
      Value: "true"

    Reference


    For more information about known issues in the .NET Framework 4.7, see Known issues for .NET Framework 4.7.


    Last Updated: Aug 2, 2017
    • Email
    • Print
    Thanks! Your feedback will help us improve the support experience.

    What's new

    • Surface Book 2
    • Surface Pro
    • Xbox One X
    • Xbox One S
    • VR & mixed reality
    • Windows 10 apps
    • Office apps

    Store & Support

    • Account profile
    • Download Center
    • Sales & support
    • Returns
    • Order tracking
    • Store locations
    • Support

    Education

    • Microsoft in education
    • Office for students
    • Office 365 for schools
    • Deals for students & parents
    • Microsoft Azure in education

    Enterprise

    • Microsoft Azure
    • Enterprise
    • Data platform
    • Microsoft partner resources
    • Manufacturing & resources
    • Financial services

    Developer

    • Microsoft Visual Studio
    • Developer Network
    • TechNet
    • Microsoft Virtual Academy
    • Channel 9
    • Office Dev Center

    Company

    • Careers
    • About Microsoft
    • Company news
    • Privacy at Microsoft
    • Investors
    • Security
    English (Canada)
    • Terms of use
    • Privacy & cookies
    • Trademarks
    • © Microsoft 2018
    This site in other countries/regions
    Algérie - Français
    Argentina - Español
    Australia - English
    Belgique - Français
    België - Nederlands
    Bolivia - Español
    Bosna i Hercegovina - Hrvatski
    Brasil - Português
    Canada - English
    Canada - Français
    Chile - Español
    Colombia - Español
    Costa Rica - Español
    Crna Gora - Srpski
    Danmark - Dansk
    Deutschland - Deutsch
    Dominican Republic - Español
    Ecuador - Español
    Eesti - Eesti
    El Salvador - Español
    España - Español
    Estados Unidos - Español
    France - Français
    Guatemala - Español
    Hong Kong SAR - English
    Hrvatska - Hrvatski
    India - English
    Indonesia (Bahasa) - Bahasa
    Ireland - English
    Italia - Italiano
    Latvija - Latviešu
    Lietuva - Lietuvių
    Luxembourg - Français
    Magyarország - Magyar
    Malaysia - English
    Maroc - Français
    México - Español
    Nederland - Nederlands
    New Zealand - English
    Norge - Bokmål
    Panamá - Español
    Paraguay - Español
    Perú - Español
    Philippines - English
    Polska - Polski
    Portugal - Português
    Puerto Rico - Español
    România - Română
    Schweiz - Deutsch
    Singapore - English
    Slovenija - Slovenščina
    Slovensko - Slovenčina
    South Africa - English
    Srbija - Srpski
    Suisse - Français
    Suomi - Suomi
    Sverige - Svenska
    Tunisie - Français
    Türkiye - Türkçe
    United Kingdom - English
    United States - English
    Uruguay - Español
    Venezuela - Español
    Việt Nam - Tiếng việt
    Ísland - Íslenska
    Österreich - Deutsch
    Česká Republika - Čeština
    Ελλάδα - Ελληνικά
    България - Български
    Казахстан - Русский
    Россия - Русский
    Україна - Українська
    ישראל - עברית
    الإمارات العربية المتحدة - العربية
    المملكة العربية السعودية - العربية
    مصر - العربية
    भारत - हिंदी
    ไทย - ไทย
    中国 - 简体中文
    台灣 - 繁體中文
    日本 - 日本語
    香港特別行政區 - 繁體中文
    대한민국 - 한국어