Home Dashboard Directory Help
Search

The type initializer for 'MS.Win32.Penimc.UnsafeNativeMethods' threw an exception. by zproxy


Status: 

Resolved
 as Fixed Help for as Fixed


7
0
Sign in
to vote
Type: Bug
ID: 499420
Opened: 10/22/2009 4:24:25 AM
Access Restriction: Public
1
Workaround(s)
view
7
User(s) can reproduce this bug

Description

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()
Details
Sign in to post a comment.
Posted by dethswatch on 1/31/2010 at 2:01 PM
everything was working fine for me. Then I plugged in a wacom intuos 3 pad and things continued to work. So then I installed the wacom software for the pad (specifically the vista 64 hardware drivers "WacomTablet_613-5-vista32-64.exe").

THEN I tried to use it in Expression Design and it worked for a few minutes until I dragged the pen off the screen and it crashed. From then on, I could not start -any- of the expression products OR the install!

That's a pretty bad situation.

I read that I could get into the verbose install by doing "setup.exe -l*V" and looking for the log in the temp dir, then finally got the actual error.

The workaround (run as admin) fixed it.

Thanks!
Posted by cpuchip on 11/11/2009 at 6:55 PM
After uninstalling Visual Studio 2010 beta 1 to Install Visual Studio 2010 Beta 2 about 6 of my programs crashed on load( All of Microsoft Expression Studio 3, being one of them). I threw one of them in the (VS 2010 Beta 2 ultamate) debugger and got this exception: 'MS.Win32.Penimc.UnsafeNativeMethods' threw an exception

searching for that I found this thread. Tried the workaround, and it did the trick. Joyful. That should be one of the things to patch after unistalling visual studio 2010 beta 1. I don't know why it was deregistered...

Sincerely,
Michael
Vista Ultamate 32bit.
Posted by _leafnode on 11/5/2009 at 6:26 AM
I had the same symptoms, probably appeared after upgrading VS2010 to beta2. Workaround worked for me.
Posted by Microsoft on 10/26/2009 at 1:56 AM
Thanks for your feedback. We are routing this bug to the product unit who works on that specific feature area. The team will review this issue and make a decision on whether they will fix it or not for the next release.

Thank you,
Visual Studio Product Team
Posted by Olly A on 10/23/2009 at 12:26 PM
Just to clarify my last comment, I can't find any reference to the CLSID {14D4CBD9-7490-4F25-BAA6-1C5E22F6B1E3} on my machine, but a scan on the net suggests it's for PenIMC.dll as I said, but maybe an older version. Or this could be a complete red herring.
Posted by Olly A on 10/23/2009 at 11:56 AM
I have the bug. My WPF/EF project converted fine from VS 2008, but it does not run. Instead, this error. Also, the original VS2008 version now also does not run. I will have to use system restore to try to get it going again :-(

This is on Vista 64 bit.

The CLSID mentioned seems to refer to PenIMC.dll; the CLSID is not present in my registry, but I do have a graphics tablet attached, if that's anything to do with it.

System.TypeInitializationException was unhandled
Message=The type initializer for 'MS.Win32.Penimc.UnsafeNativeMethods' threw an exception.
Source=PresentationCore
TypeName=MS.Win32.Penimc.UnsafeNativeMethods
StackTrace:
     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.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.ShowHelper(Object booleanBox)
     at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
     at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
     at System.Windows.Threading.DispatcherOperation.InvokeImpl()
     at System.Threading.ExecutionContext.runTryCode(Object userData)
     at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Windows.Threading.DispatcherOperation.Invoke()
     at System.Windows.Threading.Dispatcher.ProcessQueue()
     at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
     at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
     at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
     at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
     at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
     at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
     at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
     at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
     at System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg)
     at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
     at System.Windows.Application.RunInternal(Window window)
     at TMS_Programme_Manager.App.Main() in C:\Users\Oliver\Documents\Visual Studio 2010\Projects\TMS Programme Manager\TMS Programme Manager\obj\Debug\App.g.cs:line 0
     at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
     at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Runtime.InteropServices.COMException
     Message=Retrieving the COM class factory for component with CLSID {14D4CBD9-7490-4F25-BAA6-1C5E22F6B1E3} failed due to the following error: 80040154.
     Source=PresentationCore
     ErrorCode=-2147221164
     StackTrace:
            at MS.Win32.Penimc.UnsafeNativeMethods..cctor()
     InnerException:
Posted by Eric De Carufel on 10/23/2009 at 5:04 AM
I have this bug also. I don't know if it is related to some windows update I made of because I installed Visual Studio 2010 Beta 2. All my WPF application are not working anymore. For example here is an error dump of them:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
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 following 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.Controls.Primitives.Popup.PopupSecurityHelper.BuildWindow(Int32 x, Int32 y, Visual placementTarget, Boolean transparent, HwndSourceHook hook, AutoResizedEventHandler handler)
at System.Windows.Controls.Primitives.Popup.BuildWindow(Visual targetVisual)
at System.Windows.Controls.Primitives.Popup.CreateWindow(Boolean asyncCall)
at System.Windows.Controls.Primitives.Popup.OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at System.Windows.Data.BindingOperations.SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding)
at System.Windows.Controls.Primitives.Popup.CreateRootPopup(Popup popup, UIElement child)
at System.Windows.Controls.ContextMenu.HookupParentPopup()
at System.Windows.Controls.ContextMenu.OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at System.Windows.Controls.ContextMenu.set_IsOpen(Boolean value)
at TFS_Build_Status_Tray.NotifyIcon.a()
at TFS_Build_Status_Tray.NotifyIcon.c(Object A_0, MouseEventArgs A_1)
at System.Windows.Forms.NotifyIcon.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.NotifyIcon.WmMouseUp(Message& m, MouseButtons button)
at System.Windows.Forms.NotifyIcon.WndProc(Message& msg)
at System.Windows.Forms.NotifyIcon.NotifyIconNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4200 (NetFxQFE.050727-4200)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
TFS Build Status Tray
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/TFS%20Tools/TFS%20Build%20Status%20Tray/TFS%20Build%20Status%20Tray.exe
----------------------------------------
PresentationFramework
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.4000 built by: QFE
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/PresentationFramework/3.0.0.0__31bf3856ad364e35/PresentationFramework.dll
----------------------------------------
WindowsBase
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.4000 built by: QFE
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/WindowsBase/3.0.0.0__31bf3856ad364e35/WindowsBase.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
PresentationCore
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.4000 built by: QFE
    CodeBase: file:///C:/Windows/assembly/GAC_32/PresentationCore/3.0.0.0__31bf3856ad364e35/PresentationCore.dll
----------------------------------------
Microsoft.TeamFoundation.Build.Client
    Assembly Version: 9.0.0.0
    Win32 Version: 9.0.30729.1
    CodeBase: file:///C:/Windows/assembly/GAC_32/Microsoft.TeamFoundation.Build.Client/9.0.0.0__b03f5f7f11d50a3a/Microsoft.TeamFoundation.Build.Client.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4016 (NetFxQFE.050727-4000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
PresentationFramework.Aero
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.4000 built by: QFE
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/PresentationFramework.Aero/3.0.0.0__31bf3856ad364e35/PresentationFramework.Aero.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Sign in to post a workaround.
Posted by zproxy on 10/30/2009 at 4:37 AM
A fix for the issue:

C:\Windows\Microsoft.NET\Framework\v3.0\WPF>regsvr32 PenIMC.dll

http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/ccb2c002-2cdd-4e89-bb5c-1ebdc5d7e775

Current entry has been marked as non-blocking as of now.