-
Couldn't load subscription status.
- Fork 13.1k
Description
Using Visual Studio 2013, Update 5 (12.0.40629.00)
TypeScript Version: what came with VS (TypeScriptLanguageService.dll version 12.0.31101.0 shp)
We have solutions containing websites that use TypeScript files.
Upon opening the solution in VS, sometimes VS hangs.
Sometimes the 'workaround' may be to kill VS, delete the suo file and try opening again the solution, but even this doesn't work 100% reliable (besides introducing data loss as debugging breakpoints, target configuration, etc)
Expected behavior:
Solution should open
Actual behavior:
VS hangs with callstack below.
Notice TypeScriptLanguageService uses tasks supposed to run as background tasks and call BackgroundThreadQueue.Loop(), however the code is actually run on main/UI Thread (on IVsTaskSchedulerService, when there is no keyboard/mouse input, with VSTC_UITHREAD_BACKGROUND_PRIORITY). The Loop() function waits for an event, this.newTaskEvent.WaitOne() for new tasks to be pushed to the queue. For some reason, the event doesn't get set anymore, and the UI thread freezes, solution never completes opening

TypeScriptDeadLock_mini_devenv.zip
WindowsBase.dll!System.Windows.Threading.DispatcherSynchronizationContext.Wait(System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) Line 108 C#
mscorlib.dll!System.Threading.SynchronizationContext.InvokeWaitMethodHelper(System.Threading.SynchronizationContext syncContext, System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) Line 349 C#
[Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle waitableSafeHandle, long millisecondsTimeout, bool hasThreadAffinity, bool exitContext) Line 243 C#
mscorlib.dll!System.Threading.WaitHandle.WaitOne(int millisecondsTimeout, bool exitContext) Line 194 C#
mscorlib.dll!System.Threading.WaitHandle.WaitOne() Line 215 C#
TypeScriptLanguageService.dll!TypeScriptLanguageService.Threading.BackgroundThreadQueue.Loop() Line 142 C#
mscorlib.dll!System.Threading.Tasks.Task.InnerInvoke() Line 2884 C#
mscorlib.dll!System.Threading.Tasks.Task.Execute() Line 2498 C#
mscorlib.dll!System.Threading.Tasks.Task.ExecutionContextCallback(object obj) Line 2861 C#
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 954 C#
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 902 C#
mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot) Line 2827 C#
mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution) Line 2767 C#
mscorlib.dll!System.Threading.Tasks.TaskScheduler.TryExecuteTask(System.Threading.Tasks.Task task) Line 442 C#
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.TaskSchedulerService.VsUIThreadBlockableTaskScheduler.DoOneTask() Line 146 C#
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.TaskSchedulerService.VsUIBackgroundPriorityScheduler.ProcessQueue() Line 105 C#
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.TaskSchedulerService.VsUIBackgroundPriorityScheduler.OnTimerTick(object sender, System.EventArgs e) Line 124 C#
WindowsBase.dll!System.Windows.Threading.DispatcherTimer.FireTick(object unused) Line 318 C#
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Line 104 C#
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Line 37 C#
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() Line 583 C#
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state) Line 528 C#
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 954 C#
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 902 C#
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 891 C#
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 197 C#
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() Line 441 C#
WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() Line 2232 C#
WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Line 2485 C#
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Line 341 C#
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Line 494 C#
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Line 104 C#
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Line 37 C#
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Line 1445 C#
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Line 392 C#
[Native to Managed Transition]
user32.dll!InternalCallWinProc@20() Line 116 Unknown
user32.dll!UserCallWinProcCheckWow(_ACTIVATION_CONTEXT * pActCtx, void * pfn, HWND * hwnd, WM_VALUE msg, unsigned int wParam, long lParam, void * fEnableLiteHooks, int) Line 184 C
user32.dll!DispatchMessageWorker(tagMSG * pmsg, int fAnsi) Line 2931 C
user32.dll!DispatchMessageW(const tagMSG * lpMsg) Line 1002 C
msenv.dll!MainMessageLoop::ProcessMessage(IMsoStdComponentMgr * pstdcm, IVsWindowManager * pIVsWindowManager, tagMSG & msg) Line 1447 C++
msenv.dll!CMsoCMHandler::EnvironmentMsgLoop() Line 453 C++
msenv.dll!CMsoCMHandler::FPushMessageLoop(unsigned long uReason) Line 358 C++
msenv.dll!SCM::FPushMessageLoop(SCMI * pscmi, unsigned long uReason, void * pvLoopData) Line 2243 C++
msenv.dll!SCM_MsoCompMgr::FPushMessageLoop(unsigned long dwComponentID, unsigned long uReason, void * pvLoopData) Line 2999 C++
msenv.dll!CMsoComponent::PushMsgLoop(unsigned long msgloop) Line 708 C++
msenv.dll!VStudioMainLogged() Line 1077 C++
msenv.dll!VStudioMain(MAINPARAM * pMainParam) Line 1158 C++
devenv.exe!util_CallVsMain(MAINPARAM * pMainParam, int * piRes) Line 1072 C++
devenv.exe!CDevEnvAppId::Run(wchar_t * wszCmdLine, int nCmdShow) Line 706 C++
devenv.exe!WinMain(HINSTANCE_ * hInstance, HINSTANCE__ * __formal, char * lpCmdLine, int nCmdShow) Line 64 C++
devenv.exe!__tmainCRTStartup() Line 618 C
kernel32.dll!BaseThreadInitThunk(unsigned long RunProcessInit, long(_stdcall)(void *) StartAddress, void * Argument) Line 64 C
ntdll.dll!__RtlUserThreadStart(long(_stdcall)(void _) StartAddress, void * Argument) Line 997 C
ntdll.dll!_RtlUserThreadStart(long(_stdcall)(void *) StartAddress, void * Argument) Line 914 C