microsoft / microsoft/nodejstools

VS hangs if building changed files with test explorer open

Open
#2,185 2 comments 0 reactions 1 assignee View on GitHub

@armanio123 is already working on this.

Since Jun 27, 2019.

Dominant language
C#
Stars
1.8k
Forks
355
PR merge metrics
No merged PRs in 30d

Description

Expected Behavior

New tests get discoverer

Actual Behavior

VS freezes

Here are the two stacks which contain both the file watcher service and the nodejs TestAdapter when the freeze occurs:

Not Flagged		16544	0	Main Thread	Main Thread	Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.NoMessagePumpSyncContext.Wait
mscorlib.dll!System.Threading.Tasks.Task.Wait(System.TimeSpan timeout)
Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.WaitSynchronouslyCore(System.Threading.Tasks.Task task)
Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run<string>(System.Func<System.Threading.Tasks.Task<string>> asyncMethod)
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.FileChangeService.RunWithTracing<string>(Microsoft.VisualStudio.Services.FileChangeService.CompletionTracer tracer, System.Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<string>> func)
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.FileChangeService.UnadviseFileChange(uint cookie)
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.FileChangeService.Microsoft.VisualStudio.Shell.Interop.IVsFileChangeEx.UnadviseFileChange(uint cookie)
Microsoft.NodejsTools.TestAdapterImpl.dll!Microsoft.NodejsTools.TestAdapter.TestFilesUpdateWatcher.RemoveFileWatch(string path)
Microsoft.NodejsTools.TestAdapterImpl.dll!Microsoft.NodejsTools.TestAdapter.TestContainerDiscoverer.OnProjectItemChanged(object sender, Microsoft.NodejsTools.TestAdapter.TestFileChangedEventArgs e)
Microsoft.NodejsTools.TestAdapterImpl.dll!Microsoft.NodejsTools.TestAdapter.TestFilesUpdateWatcher.FilesChanged.AnonymousMethod__0()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.SingleExecuteProtector.TryExecute()
Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run<bool>(System.Func<System.Threading.Tasks.Task<bool>> asyncMethod, Microsoft.VisualStudio.Threading.JoinableTaskCreationOptions creationOptions)
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.FileChangeService.RunWithTracing<bool>(Microsoft.VisualStudio.Services.FileChangeService.CompletionTracer tracer, System.Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<bool>> func)
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.FileChangeService.RunWithTracing(Microsoft.VisualStudio.Services.FileChangeService.CompletionTracer tracer, System.Func<System.Threading.CancellationToken, System.Threading.Tasks.Task> func)
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.FileChangeService.SyncFile(string filename)
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.FileChangeService.Microsoft.VisualStudio.Shell.Interop.IVsFileChangeEx.SyncFile(string filename)
Microsoft.VisualStudio.Editor.Implementation.dll!Microsoft.VisualStudio.Editor.Implementation.TextDocData.SuspendFileChangeNotification(string pszFilename, int fSuspend)
Microsoft.VisualStudio.Editor.Implementation.dll!Microsoft.VisualStudio.Editor.Implementation.TextDocData.BaseSave(string pszFilename, int fRemember)
Microsoft.VisualStudio.Editor.Implementation.dll!Microsoft.VisualStudio.Editor.Implementation.TextDocData.Save(string pszFilename, int fRemember, uint nFormatIndex)
Microsoft.VisualStudio.Editor.Implementation.dll!Microsoft.VisualStudio.Editor.Implementation.TextDocData.Save(string pszFileName, int fRemember)

Not Flagged		25740	0	Worker Thread	Worker Thread	Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.WaitSynchronouslyCore
[Managed to Native Transition]
mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout, bool exitContext)
mscorlib.dll!System.Threading.Tasks.Task.Wait(System.TimeSpan timeout)
Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.WaitSynchronouslyCore(System.Threading.Tasks.Task task)
Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run<int>(System.Func<System.Threading.Tasks.Task<int>> asyncMethod, Microsoft.VisualStudio.Threading.JoinableTaskCreationOptions creationOptions)
Microsoft.NodejsTools.TestAdapterImpl.dll!Microsoft.NodejsTools.TestAdapter.TestFilesUpdateWatcher.FilesChanged(uint cChanges, string[] rgpszFile, uint[] rggrfChange)
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.FileChange.EventSinkBundle.FilesChanged(string[] files, uint[] changes, string traceInfo)
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.FileChange.NotificationPool.FileChangeJob.ProcessCore(System.Threading.CancellationToken cancellationToken)
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.FileChange.NotificationPool.Job.Process(System.Threading.CancellationToken cancellationToken)
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.FileChange.NotificationPool.ProcessNotificationsAsync(Microsoft.VisualStudio.Services.FileChange.NotificationPool.AsyncJobQueue queue, bool callInBackground, System.Threading.CancellationToken token)
[Resuming Async Method]
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine)
mscorlib.dll!System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.RunAction(object state)
mscorlib.dll!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
[Native to Managed Transition]

  • NTVS Version: 1.5.10610.1 Commit Hash:529a87de2769e143655e31ea81795c42e5775ef8
  • Visual Studio Version: 16.2 preview 4
  • Node.js Version: 8.1.4
Steps to Reproduce
  1. Open a csproj and add a javascript test file
  2. Update the file and run build
  3. Sometimes the tests get rediscovered and sometimes VS freezes

Note that as part of these I was often closing/reopening projects and deleting/creating the javascript files.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.