I'm using Visual Studio 2008 Team Suite and I'm unable to run tests and display the Test/Windows/Test Result Window.
The result is a dialog box with the following content : "Exception has been thrown by the target of an invocation".
Team Explorer has been installed after Visual Studio 2008 SP1. So I have re-apllied the service pack.
Searching the web I found that this error is pretty common but unfortunately, the proposed solutions does not work for me. The problem was never analysed so I decided to give it a try : I reproduced the problem on a computer, attached the process with windbg and start with the basic investigations.
Following are the first results :
0:000>!dumpstack
OS Thread Id: 0xdb0 (0)
Current frame: USER32!NtUserWaitMessage+0x15
ChildEBP RetAddr Caller,Callee
003fec94 75a32674 USER32!DialogBox2+0x222, calling USER32!NtUserWaitMessage
003fecd0 75a3288a USER32!InternalDialogBox+0xe5, calling USER32!DialogBox2
003fecfc 75a6f8d0 USER32!SoftModalMessageBox+0x757, calling USER32!InternalDialogBox
003fed3c 6eb61996 mscorwks!Thread::ReverseLeaveRuntime+0x95, calling mscorwks!_EH_epilog3
003fedb0 75a6fbac USER32!MessageBoxWorker+0x269, calling USER32!SoftModalMessageBox
003fede0 6ea559c3 mscorwks!SetupThreadNoThrow+0x19a, calling mscorwks!_EH_epilog3_catch_GS
003fee24 6eb61d8a mscorwks!HasIllegalReentrancy+0xac, calling mscorwks!_EH_epilog3
003fee30 6ea89796 mscorwks!SimpleComCallWrapper::Release+0x2e, calling mscorwks!CompareExchangeMP
003fee38 6ea0da05 mscorwks!CLRException::HandlerState::CleanupTry+0x16, calling mscorwks!GetCurrentSEHRecord
003fee44 6ea0c9c0 mscorwks!Thread::EnablePreemptiveGC+0xf, calling mscorwks!Thread::CatchAtSafePoint
003fee4c 6ea8a241 mscorwks!Unknown_Release_Internal+0x24d, calling mscorwks!GCHolder<1,0,0>::Pop
003fee50 6ea0c86c mscorwks!_EH_epilog3_catch_GS+0xa, calling mscorwks!__security_check_cookie
003fee54 6ea8a24c mscorwks!Unknown_Release_Internal+0x258, calling mscorwks!_EH_epilog3_catch_GS
003fee7c 75a16941 USER32!UserCallWinProcCheckWow+0x13d, calling ntdll!RtlDeactivateActivationContextUnsafeFast
003feed8 7082119e msenv!ATL::CComCritSecLock<ATL::CComCriticalSection>::Lock+0xd, calling ntdll!RtlEnterCriticalSection
003fef08 75a6fe5b USER32!MessageBoxIndirectW+0x2e, calling USER32!MessageBoxWorker
003fef7c 70a1e367 msenv!MessageBoxPVoidW+0xda
003fefd4 70a1db60 msenv!VBDialogCover2+0x11b
003ff01c 70a1e4c0 msenv!VBMessageBox2W+0xf0, calling msenv!VBDialogCover2
003ff044 7087246b msenv!main_GetAppNameW+0xa, calling msenv!GetAppNameInternal
003ff04c 70a1e4f2 msenv!VBMessageBox3W+0x1c, calling msenv!VBMessageBox2W
003ff064 70a1d6d7 msenv!_IdMsgShow+0x362, calling msenv!VBMessageBox3W
003ff0cc 70951841 msenv!TaskDialogCallback+0x7e0, calling msenv!_IdMsgShow
003ff118 6eb20da4 mscorwks!Unknown_QueryInterface+0x230, calling mscorwks!_EH_epilog3_catch_GS
003ff14c 6eb20c43 mscorwks!Unknown_QueryInterface_Internal+0x3d8, calling mscorwks!_EH_epilog3_catch_GS
003ff168 02006ec4 02006ec4, calling 0247a1e8
003ff16c 6ea0c86c mscorwks!_EH_epilog3_catch_GS+0xa, calling mscorwks!__security_check_cookie
003ff198 6eb20562 mscorwks!COMToCLRWorker+0xb34, calling mscorwks!_EH_epilog3_catch_GS
003ff19c 0247a235 0247a235, calling mscorwks!COMToCLRWorker
003ff1c4 7083249f msenv!CVSCommandTarget::ExecCmd+0x937
003ff1e4 7086d5c8 msenv!VsReportErrorInfo+0x11, calling msenv!TaskDialogCallback+0xd8
003ff1f8 7093e65b msenv!CVSCommandTarget::ExecCmd+0x945, calling msenv!VsReportErrorInfo
003ff25c 7081f53a msenv!ATL::CComPtr<IVsLanguageInfo>::~CComPtr<IVsLanguageInfo>+0x24, calling msenv!_EH_epilog3
003ff260 70b18d72 msenv!LogCommand+0x4c, calling msenv!ATL::CComPtr<IVsCodePageSelection>::~CComPtr<IVsCodePageSelection>
003ff264 70b18d77 msenv!LogCommand+0x51, calling msenv!_EH_epilog3
003ff280 70a4fd0e msenv!CMsoButtonUser::FClick+0x1d1, calling msenv!CVSCommandTarget::ExecCmd
003ff2f4 70823a87 msenv!CTLSITE::QueryInterface+0x16
003ff31c 70cb7d4d msenv!TBCB::FNotifyFocus+0x204
003ff35c 70ce5fda msenv!TB::NotifyControl+0x101
003ff3bc 709910f6 msenv!TB::FRequestFocus+0x4ed, calling msenv!TB::NotifyControl
003ff414 708254ba msenv!CMsoButtonUser::FEnabled+0x3d, calling msenv!GetQueryStatusFlags
003ff428 7086222a msenv!TBC::FAutoEnabled+0x24
003ff43c 7098e1eb msenv!TB::LProcessInputMsg+0xdb4
003ff458 6bec1c49 (MethodDesc 0x6bcd7f54 +0x89 System.Windows.Forms.Form.DefWndProc(System.Windows.Forms.Message ByRef)), calling 6be3b738
003ff50c 70823ab0 msenv!FPtbFromSite+0x16
003ff520 70991c43 msenv!TB::PtbParent+0x25, calling msenv!FPtbFromSite
003ff52c 708dda49 msenv!TBWndProc+0x2da
003ff588 0203d770 0203d770, calling 0247a1e8
003ff598 70822a70 msenv!CPaneFrame::Release+0x118, calling msenv!_EH_epilog3
003ff5b0 75a16238 USER32!InternalCallWinProc+0x23
003ff5dc 75a168ea USER32!UserCallWinProcCheckWow+0x109, calling USER32!InternalCallWinProc
003ff620 75a16899 USER32!UserCallWinProcCheckWow+0x6a, calling ntdll!RtlActivateActivationContextUnsafeFast
003ff654 75a17d31 USER32!DispatchMessageWorker+0x3bc, calling USER32!UserCallWinProcCheckWow
003ff688 70847f2b msenv!CMsoComponent::FPreTranslateMessage+0x72, calling msenv!MainFTranslateMessage
003ff6b4 75a17dfa USER32!DispatchMessageW+0xf, calling USER32!DispatchMessageWorker
003ff6c4 70831553 msenv!EnvironmentMsgLoop+0x1ea, calling USER32!DispatchMessageW
003ff6f8 708eb9bd msenv!CMsoCMHandler::FPushMessageLoop+0x86, calling msenv!EnvironmentMsgLoop
003ff724 708eb94d msenv!SCM::FPushMessageLoop+0xb7
003ff74c 708eb8e9 msenv!SCM_MsoCompMgr::FPushMessageLoop+0x28, calling msenv!SCM::FPushMessageLoop
003ff768 708eb8b8 msenv!CMsoComponent::PushMsgLoop+0x28
003ff788 708ebe4e msenv!VStudioMainLogged+0x482, calling msenv!CMsoComponent::PushMsgLoop
003ff7ac 70882afe msenv!CVsActivityLogSingleton::Instance+0xdf, calling msenv!_EH_epilog3
003ff7d8 70882afe msenv!CVsActivityLogSingleton::Instance+0xdf, calling msenv!_EH_epilog3
003ff7dc 707e4e31 msenv!VActivityLogStartupEntries+0x42
003ff7f4 7081f63b msenv!ATL::CComPtr<IClassFactory>::~CComPtr<IClassFactory>+0x24, calling msenv!_EH_epilog3
003ff7f8 708b250f msenv!ATL::CComQIPtr<IUnknown,&IID_IUnknown>::~CComQIPtr<IUnknown,&IID_IUnknown>+0x1d, calling msenv!_EH_epilog3
003ff820 708e7561 msenv!VStudioMain+0xc1, calling msenv!VStudioMainLogged
003ff84c 2f32aabc devenv!util_CallVsMain+0xff
003ff878 2f3278f2 devenv!CDevEnvAppId::Run+0x11fd, calling devenv!util_CallVsMain
003ff97c 77533b23 ntdll!RtlpAllocateHeap+0xe73, calling ntdll!_SEH_epilog4
003ff9f0 77536cd7 ntdll!RtlpLowFragHeapAllocFromContext+0x882, calling ntdll!RtlpSubSegmentInitialize
003ffa10 7753609f ntdll!RtlNtStatusToDosError+0x3b, calling ntdll!RtlNtStatusToDosErrorNoTeb
003ffa14 775360a4 ntdll!RtlNtStatusToDosError+0x40, calling ntdll!_SEH_epilog4
003ffa40 775360a4 ntdll!RtlNtStatusToDosError+0x40, calling ntdll!_SEH_epilog4
003ffa44 75bd2736 kernel32!LocalBaseRegOpenKey+0x159, calling ntdll!RtlNtStatusToDosError
003ffa48 75bd2762 kernel32!LocalBaseRegOpenKey+0x22a, calling kernel32!_SEH_epilog4
003ffac4 75bd2762 kernel32!LocalBaseRegOpenKey+0x22a, calling kernel32!_SEH_epilog4
003ffac8 75bd28c9 kernel32!RegOpenKeyExInternalW+0x130, calling kernel32!LocalBaseRegOpenKey
003ffad8 75bd28de kernel32!RegOpenKeyExInternalW+0x211
003ffae0 75bd28e5 kernel32!RegOpenKeyExInternalW+0x21d, calling kernel32!_SEH_epilog4
003ffb04 6f282e2b MSVCR90!_unlock+0x15, calling ntdll!RtlLeaveCriticalSection
003ffb14 75bd2642 kernel32!BaseRegCloseKeyInternal+0x41, calling ntdll!NtClose
003ffb28 75bd25d0 kernel32!RegCloseKey+0xd4, calling kernel32!_SEH_epilog4
003ffb5c 75bd25d0 kernel32!RegCloseKey+0xd4, calling kernel32!_SEH_epilog4
003ffb60 2f321ea4 devenv!DwInitSyncObjects+0x340
003ffb90 2f327bf4 devenv!WinMain+0x74, calling devenv!CDevEnvAppId::Run
003ffbac 2f327c68 devenv!License::GetPID+0x258, calling devenv!WinMain
003ffc3c 75bd3677 kernel32!BaseThreadInitThunk+0xe
003ffc48 77539d72 ntdll!__RtlUserThreadStart+0x70
003ffc88 77539d45 ntdll!_RtlUserThreadStart+0x1b, calling ntdll!__RtlUserThreadStart
0:000> !pe -nested
Exception object: 050aae9c
Exception type: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
InnerException: System.NullReferenceException, use !PrintException 050aac64 to see more
StackTrace (generated):
SP IP Function
003FEC2C 6D2700F7 mscorlib_ni!System.RuntimeType.CreateInstanceSlow(Boolean, Boolean)+0x57
003FEC5C 6D270067 mscorlib_ni!System.RuntimeType.CreateInstanceImpl(Boolean, Boolean, Boolean)+0xe7
003FEC94 6D270264 mscorlib_ni!System.Activator.CreateInstance(System.Type, Boolean)+0x44
003FECA4 6AD02DAF Microsoft_VisualStudio_Shell_9_0_ni!Microsoft.VisualStudio.Shell.Package.CreateToolWindow(System.Type, Int32, Microsoft.VisualStudio.Shell.ProvideToolWindowAttribute)+0x67
003FED30 6AD0311B Microsoft_VisualStudio_Shell_9_0_ni!Microsoft.VisualStudio.Shell.Package.CreateToolWindow(System.Type, Int32)+0xb7
003FED58 6AD02D12 Microsoft_VisualStudio_Shell_9_0_ni!Microsoft.VisualStudio.Shell.Package.FindToolWindow(System.Type, Int32, Boolean, Microsoft.VisualStudio.Shell.ProvideToolWindowAttribute)+0x7a
003FED88 6AD02D39 Microsoft_VisualStudio_Shell_9_0_ni!Microsoft.VisualStudio.Shell.Package.FindToolWindow(System.Type, Int32, Boolean)+0x11
003FED94 02585E30 Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.InitToolWindowVariable[[System.__Canon, mscorlib]](System.__Canon ByRef, System.String, Boolean)+0x58
003FEDD0 02585DBE Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.InitToolWindowVariable[[System.__Canon, mscorlib]](System.__Canon ByRef, System.String)+0x36
003FEDE4 02585D32 Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.ShowToolWindow[[System.__Canon, mscorlib]](System.__Canon ByRef, System.String, Boolean)+0x3a
003FEE00 02585AB4 Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.OpenTestResultsToolWindow()+0x2c
003FEE10 02585A6E Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.OnMenuViewTestResults(System.Object, System.EventArgs)+0x6
003FEE18 6CD4F993 System_ni!System.ComponentModel.Design.MenuCommand.Invoke()+0x43
003FEE40 6CD4F9D4 System_ni!System.ComponentModel.Design.MenuCommand.Invoke(System.Object)+0x8
003FEE48 6AD000FA Microsoft_VisualStudio_Shell_9_0_ni!Microsoft.VisualStudio.Shell.OleMenuCommandService.Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.Exec(System.Guid ByRef, UInt32, UInt32, IntPtr, IntPtr)+0x11a
003FEEA0 6AD03FB8 Microsoft_VisualStudio_Shell_9_0_ni!Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.Exec(System.Guid ByRef, UInt32, UInt32, IntPtr, IntPtr)+0x44
StackTraceString: <none>
HResult: 80131604
0:000> !PrintException 050aac64
Exception object: 050aac64
Exception type: System.NullReferenceException
Message: Object reference not set to an instance of an object.
InnerException: <none>
StackTrace (generated):
SP IP Function
003FE660 078E60BE Microsoft_VisualStudio_TeamSystem_Integration!Microsoft.VisualStudio.TeamSystem.Integration.TcmResultsPublishManager..ctor(Microsoft.VisualStudio.TeamSystem.Integration.ResultsPublishManager)+0xc6
003FE674 078E5C91 Microsoft_VisualStudio_TeamSystem_Integration!Microsoft.VisualStudio.TeamSystem.Integration.ResultsPublishManager..ctor(Microsoft.VisualStudio.TeamSystem.Integration.TeamFoundationHostHelper)+0x59
003FE684 078E2FA0 Microsoft_VisualStudio_TeamSystem_Integration!Microsoft.VisualStudio.TeamSystem.Integration.VsetServerHelper..ctor(System.IServiceProvider)+0x50
003FE6A4 078E2E90 Microsoft_VisualStudio_TeamSystem_Common!Microsoft.VisualStudio.TeamSystem.Integration.Client.VsetHelper.InitializeThrow(System.IServiceProvider)+0x20
003FE6B8 078E2E2A Microsoft_VisualStudio_TeamSystem_Common!Microsoft.VisualStudio.TeamSystem.Integration.Client.VsetHelper.InitializeHelper(System.IServiceProvider)+0x22
003FE6E0 078E2DEC Microsoft_VisualStudio_TeamSystem_Common!Microsoft.VisualStudio.TeamSystem.Integration.Client.VsetHelper.CreateVsetHelper(System.IServiceProvider)+0x1c
003FE6F0 078E2DAC Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.get_VsetHelper()+0x14
003FE6F8 02586BBE Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.ResultsToolWindow..ctor()+0x9f6
003FE798 02585F8A Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.ResultToolWindowHost..ctor()+0x1a
StackTraceString: <none>
HResult: 80004003
In order to be able to continue the analysis, we need to get the parameters to see what is going on.
I also tried to run devenv.exe with the /log switch. No error in the log after reproducing the problem.
Finally, If Team Explorer is removed from the system, the problem goes away.
Any help appreciated.
TIA.
Olivier.