Visual Studio IDE may crash without any error message


While launching Visual Studio 2012/2010 IDE, Visual Studio IDE may crash without any error message. I launched the devenv.exe in the debugger and took a crash dump. You can also run the following command to capture a crash dump: cscript adplus.vbs -crash –sc "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe"

After debugging I found the below Call Stack and the exception:

0:000> kL
ChildEBP RetAddr 
00ebe444 73c390bf KERNELBASE!RaiseException+0x6c
00ebe4e8 73d70a4c clr!RaiseTheExceptionInternalOnly+0x276
00ebe500 73d70c7d clr!RaiseTheException+0x86
00ebe528 73d70cad clr!RealCOMPlusThrowWorker+0x72
(Inline) ——– clr!RealCOMPlusThrow+0x23
00ebe55c 73cefae6 clr!RealCOMPlusThrow+0x2f
00ebea44 73b63fbe clr!MethodTable::DoRunClassInitThrowing+0x382
00ebeacc 73b64022 clr!JIT_GetSharedNonGCStaticBase_Helper+0x85
00ebeb14 06c82520 clr!JIT_GetSharedNonGCStaticBase_Portable+0x2f
00ebeb14 06c82520 WindowsBase!MS.Win32.HwndSubclass.HookWindowProc(IntPtr, WndProc, IntPtr)+0x50
00ebeb24 06c82292 WindowsBase!MS.Win32.HwndSubclass.HookWindowProc(IntPtr, WndProc, IntPtr)+0x50
00ebeb64 0347a24d WindowsBase!MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)+0x5a
00ebeb98 750377d8 CLRStub[StubLinkStub]@9f897f120347a24d
00ebebc4 750378cb user32!InternalCallWinProc+0x23
00ebec40 75037b6f user32!UserCallWinProcCheckWow+0x100
00ebeca4 7503e4e0 user32!DispatchClientMessage+0x15d
00ebecdc 77942c92 user32!__fnINOUTLPPOINT5+0x2e
00ebecf0 0160f320 ntdll!KiUserCallbackDispatcher+0x2e

0:000> !pe
Exception object: 04041f58
Exception type:   System.TypeInitializationException
Message:          The type initializer for ‘MS.Win32.ManagedWndProcTracker’ threw an exception.
InnerException:   System.BadImageFormatException, Use !PrintException 04040794 to see more.

StackTrace (generated):
    SP       IP       Function
    00EBEAEC 06C82964 WindowsBase!MS.Win32.ManagedWndProcTracker.TrackHwndSubclass(MS.Win32.HwndSubclass, IntPtr)+0x2c
    00EBEB1C 06C82520 WindowsBase!MS.Win32.HwndSubclass.HookWindowProc(IntPtr, WndProc, IntPtr)+0x50
    00EBEB34 06C82292 WindowsBase!MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)+0x5a

StackTraceString: <none>
HResult: 80131534

0:000> !PrintException 04040794
Exception object: 04040794
Exception type:   System.BadImageFormatException
Message:          Bad IL range.
InnerException:   <none>
StackTrace (generated):
    SP       IP       Function
    00000000 00000001 WindowsBase!MS.Internal.ShutDownListener..ctor(System.Object, MS.Internal.ShutDownEvents)+0x2
    00EBE3F4 06C82ACA WindowsBase!MS.Win32.ManagedWndProcTracker+ManagedWndProcTrackerShutDownListener..ctor()+0xa
    00EBE3F8 06C82AA7 WindowsBase!MS.Win32.ManagedWndProcTracker..cctor()+0x9f

StackTraceString: <none>
HResult: 8007000b

0:000> .frame06
06 00ebea44 73b63fbe clr!MethodTable::DoRunClassInitThrowing+0x382

0:000> dv /v /t
@esi              class MethodTable * this = 0x06c9544c
00ebe590          class GCCoop __gcHolder = class GCCoop
00ebe5f8          class AppDomain * pDomain = 0x01079850
00ebe5dc          class Thread * pThread = 0x010be9f8
@edi              class ListLock * _pLock = 0x061dd010
00ebe600          class Wrapper<ListLock *,&ListLock::HolderEnter,&ListLock::HolderLeave,0,&CompareDefault<ListLock *>,2,1> pInitLock = class Wrapper<ListLock *,&ListLock::HolderEnter,&ListLock::HolderLeave,0,&CompareDefault<ListLock *>,2,1>
<unavailable>     struct MethodTable::DoRunClassInitThrowing::__l18::_gc gc = <value unavailable>
<unavailable>     class ListLockEntry * pEntry = <value unavailable>
<unavailable>     class FrameWithCookie<GCFrame> __gcframe = <value unavailable>
<unavailable>     unsigned long hOrigInitException = <value unavailable>
<unavailable>     class InlineSString<1024> _ssclsname_w_ = <value unavailable>
<unavailable>     wchar_t * wszName = <value unavailable>
00ebe5d8          unsigned long hNewInitException = 0x6c82938
<unavailable>     class CLRException::HandlerState __state = <value unavailable>
<unavailable>     class CAutoTryCleanup<CLRException::HandlerState> __autoCleanupTry = <value unavailable>
00ebe59c          class Exception * __pExceptionRaw = 0x73b6c86f
<unavailable>     class CLRLastThrownObjectException __defaultException = <value unavailable>
<unavailable>     class ExceptionHolderTemplate<Exception> __pException = <value unavailable>
<unavailable>     class ListLockEntry::LockHolder pLock = <value unavailable>
<unavailable>     class ReleaseHolder<ListLockEntry> pEntry = <value unavailable>
<unavailable>     struct MethodTable::DoRunClassInitThrowing::__l80::_gc gc = <value unavailable>
00ebe574          class FrameWithCookie<GCFrame> __gcframe = class FrameWithCookie<GCFrame>
<unavailable>     class InlineSString<1024> _ssclsname_w_ = <value unavailable>
@ebx              wchar_t * wszName = 0x00ebe628 "MS.Win32.ManagedWndProcTracker"
<unavailable>     class CLRException::HandlerState __state = <value unavailable>
<unavailable>     class CAutoTryCleanup<CLRException::HandlerState> __autoCleanupTry = <value unavailable>
00ebe598          class Exception * __pExceptionRaw = 0x00ebe920
<unavailable>     class CLRLastThrownObjectException __defaultException = <value unavailable>
<unavailable>     class ExceptionHolderTemplate<Exception> __pException = <value unavailable>

0:000> !dumpmt 0x06c9544c
EEClass:         06c48194
Module:          03473d48
Name:            MS.Win32.ManagedWndProcTracker
mdToken:         020002a2
File:           C:\Windows\Microsoft.Net\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\WindowsBase.dll
BaseSize:        0xc
ComponentSize:   0x0
Slots in VTable: 11
Number of IFaces in IFaceMap: 0

I saved the module WindowsBase.dll locally by running the below command:

0:000> !savemodule 06da0000 C:\WindowsBase.dll

From the Visual Studio command prompt, I ran the following command to validate the MSIL and metadata: C:\>peverify  WindowsBase.dll

Microsoft (R) .NET Framework PE Verifier.  Version  4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

[MD]: Error: Method has invalid local signature token (0x01af0039). [token:0x06000AFC]
1 Error(s) Verifying C:\WindowsBase.dll

Hence, I copied the file WindowsBase.dll  from an another working system and launched Visual Studio IDE successfully.


Comments (0)

Skip to main content