.NET Framework Developer Center > .NET Development Forums > Windows Presentation Foundation (WPF) > The type initializer for 'MS.Win32.Penimc.UnsafeNativeMethods' threw an exception
Ask a questionAsk a question
 

AnswerThe type initializer for 'MS.Win32.Penimc.UnsafeNativeMethods' threw an exception

  • Friday, October 23, 2009 11:55 AMzproxy Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Can someone explain this error? It seems none of the WPF applications work on my Dell Latitude XT system starting this morning.

    Unhandled Exception: System.TypeInitializationException: The type initializer for 'MS.Win32.Penimc.UnsafeNativeMethods' threw an exception. ---> System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {14D4CBD9-7490-4F25-BAA6-1C5E22F6B1E3} failed due to the fo
    llowing error: 80040154.
    at MS.Win32.Penimc.UnsafeNativeMethods..cctor()
    --- End of inner exception stack trace ---
    at MS.Win32.Penimc.UnsafeNativeMethods.CreateResetEvent(IntPtr& handle)
    at System.Windows.Input.PenThreadWorker..ctor()
    at System.Windows.Input.PenThread..ctor()
    at System.Windows.Input.PenThreadPool.GetPenThreadForPenContextHelper(PenContext penContext)
    at System.Windows.Input.PenThreadPool.GetPenThreadForPenContext(PenContext penContext)
    at System.Windows.Input.TabletDeviceCollection.UpdateTablets()
    at System.Windows.Input.TabletDeviceCollection..ctor()
    at System.Windows.Input.StylusLogic.get_TabletDevices()
    at System.Windows.Input.StylusLogic.RegisterHwndForInput(InputManager inputManager, PresentationSource inputSource)
    at System.Windows.Interop.HwndStylusInputProvider..ctor(HwndSource source)
    at System.Windows.Interop.HwndSource.Initialize(HwndSourceParameters parameters)
    at System.Windows.Interop.HwndSource..ctor(HwndSourceParameters parameters)
    at System.Windows.Window.CreateSourceWindowImpl()
    at System.Windows.Window.SafeCreateWindow()
    at System.Windows.Window.ShowHelper(Object booleanBox)
    at System.Windows.Window.Show()
    at System.Windows.Window.ShowDialog()

    https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=499420

Answers

  • Monday, October 26, 2009 10:59 AMWang, JieMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi,

    What's your OS version and bitness (32/64)? And your .NET Framework version?

    Looks like the "Microsoft Tablet PC Component" somehow get unregistered (according to error 0x80040154 Class not registered) or corrupted.

    Can you check the PenIMC.dll in your .NET Framework 3.0 WPF folder at (replace C: and Windows with your settings if necessary):

    C:\Windows\Microsoft.NET\Framework\v3.0\WPF

    and also this if running on x64 Windows:
    C:\Windows\Microsoft.NET\Framework64\v3.0\WPF

    If the file is there, try use regsvr32 to re-register the component and see if that fix it.

    If you're on .NET Framework 4.0 Beta 2, check it in the v4.0.21006 folder.

    You can also try repair/re-install .NET Framework.

    Have you installed/uninstalled anything or made any config changes to the system before encounting this problem?

    Regards,
    Jie
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    If you have any feedback, please tell us.

    The CodeFx Project
    My Blog (in Simplified Chinese)
    • Marked As Answer byzproxy Friday, October 30, 2009 11:32 AM
    •  

All Replies

  • Monday, October 26, 2009 10:59 AMWang, JieMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi,

    What's your OS version and bitness (32/64)? And your .NET Framework version?

    Looks like the "Microsoft Tablet PC Component" somehow get unregistered (according to error 0x80040154 Class not registered) or corrupted.

    Can you check the PenIMC.dll in your .NET Framework 3.0 WPF folder at (replace C: and Windows with your settings if necessary):

    C:\Windows\Microsoft.NET\Framework\v3.0\WPF

    and also this if running on x64 Windows:
    C:\Windows\Microsoft.NET\Framework64\v3.0\WPF

    If the file is there, try use regsvr32 to re-register the component and see if that fix it.

    If you're on .NET Framework 4.0 Beta 2, check it in the v4.0.21006 folder.

    You can also try repair/re-install .NET Framework.

    Have you installed/uninstalled anything or made any config changes to the system before encounting this problem?

    Regards,
    Jie
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    If you have any feedback, please tell us.

    The CodeFx Project
    My Blog (in Simplified Chinese)
    • Marked As Answer byzproxy Friday, October 30, 2009 11:32 AM
    •