Build/Test Issues

xunit.v3 builds eternally and can't run tests

Started by adandy on 3,548 views

I am currently on 5.12.0.10 and am trying to use xunit.v3 1.1.0 but can't get NCrunch to build my test projects and it just spins forever. I suspect I am triggering some kind of corner case, possibly related to targeting multiple frameworks. I am able to run tests using `dotnet test` and the VS Test Explorer, so that much does work. The broken branch is public (with submodules) https://github.com/aarondandy/WeCantSpell.Hunspell/commits/test-updates/ for a reproduction.
Hi,

Thanks for sharing this issue with the sample solution.

I was able to run all tests to completion on this solution without problems, so perhaps there is more to this issue than the codebase itself.

Would you mind submitting a bug report while the engine is stuck spinning? Also, could you confirm which tasks the engine is stuck on? It should be possible to examine the list of tasks in the processing queue window to see what is in progress.
It gets stuck on Analyze Assembly. Somehow, this time, 2 of the 3 targets finished analysis. I have rebooted multiple times previously and usually all 3 targets would get stuck like this. I don't know what is different this time to cause the 2 to complete. I sent a report in while the net48 target was stuck, let me know if any other info can help. Now that some of the tests are running I am noticing that they are extremely slow, so that may be a clue as well.
Thanks for sending through the report.

Unfortunately the report didn't contain any useful information about the problem. The hang is not being caused by errors/exceptions being thrown in the environment as far as I can tell.

When running the tests on my side, they perform very well and churning them for a period of time doesn't surface any race conditions in their execution or in the analysis steps.

I've reviewed the configuration you're running in the bug report and nothing looks abnormal.

Do you think you can attach a debugger onto one of the hung analysis tasks and see if you can get a stack trace? If you right-click the column headers in the Processing Queue Window, you can turn on the 'Process Id' column which should allow you to identify the process running under the task. Most likely there is a thread here that is hung on something.
Well, it looks like I'm spending a hell of a lot of time here: https://github.com/xunit/xunit/blob/72878584ab032c9d7cd02a3387de36e1b3233938/src/xunit.v3.runner.utility/Utility/BufferedTextReaderWriter.cs#L59

Call stack:


 	System.Private.CoreLib.dll!System.Threading.Thread.Sleep(int millisecondsTimeout)	Unknown
 	xunit.v3.runner.utility.netcore.dll!Xunit.v3.BufferedTextReaderWriter.BufferedReader.Read() Line 59	C#
 	System.Private.CoreLib.dll!System.IO.TextReader.ReadLine()	Unknown
>	xunit.v3.runner.common.dll!Xunit.Runner.Common.ConsoleHelper.ReadLine() Line 71	C#
 	xunit.v3.runner.common.dll!Xunit.Runner.Common.ConsoleRunnerLogger.WaitForAcknowledgment() Line 106	C#
 	xunit.v3.runner.inproc.console.dll!Xunit.Runner.Common.RunnerLoggerExtensions.WriteMessage(Xunit.Runner.Common.IRunnerLogger runnerLogger, Xunit.Sdk.IMessageSinkMessage message) Line 27	C#
 	xunit.v3.runner.inproc.console.dll!Xunit.Runner.InProc.SystemConsole.ConsoleRunner.ListAssembly(Xunit.Runner.Common.XunitProjectAssembly assembly, Xunit.Runner.Common.IRunnerLogger logger) Line 312	C#
 	[Resuming Async Method]	
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Xunit.Runner.InProc.SystemConsole.ConsoleRunner.<ListAssembly>d__12>.ExecutionContextCallback(object s)	Unknown
 	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Xunit.Runner.InProc.SystemConsole.ConsoleRunner.<ListAssembly>d__12>.MoveNext(System.Threading.Thread threadPoolThread)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Xunit.Runner.InProc.SystemConsole.ConsoleRunner.<ListAssembly>d__12>.MoveNext()	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox box, bool allowInlining)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult>.TrySetResult(System.Threading.Tasks.VoidTaskResult result)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.SetExistingTaskResult(System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult> task, System.Threading.Tasks.VoidTaskResult result)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder.SetResult()	Unknown
 	[Completed] xunit.v3.runner.inproc.console.dll!Xunit.Runner.InProc.SystemConsole.ProjectAssemblyRunner.Discover(Xunit.Runner.Common.XunitProjectAssembly assembly, Xunit.v3.ITestPipelineStartup pipelineStartup, Xunit.Sdk.IMessageSink messageSink, Xunit.Sdk.IMessageSink diagnosticMessageSink, System.Collections.Generic.IList<(Xunit.Sdk.ITestCase TestCase, bool PassedFilter)> testCases) Line 101	C#
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Xunit.Runner.InProc.SystemConsole.ProjectAssemblyRunner.<Discover>d__11>.ExecutionContextCallback(object s)	Unknown
 	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Xunit.Runner.InProc.SystemConsole.ProjectAssemblyRunner.<Discover>d__11>.MoveNext(System.Threading.Thread threadPoolThread)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Xunit.Runner.InProc.SystemConsole.ProjectAssemblyRunner.<Discover>d__11>.MoveNext()	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox box, bool allowInlining)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult>.TrySetResult(System.Threading.Tasks.VoidTaskResult result)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.SetExistingTaskResult(System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult> task, System.Threading.Tasks.VoidTaskResult result)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder.SetResult()	Unknown
 	[Completed] xunit.v3.core.dll!Xunit.v3.InProcessFrontController.Find(Xunit.Sdk.IMessageSink messageSink, Xunit.Sdk.ITestFrameworkDiscoveryOptions options, System.Func<Xunit.Sdk.ITestCase, bool> filter, System.Type[] types, System.Func<Xunit.Sdk.ITestCase, bool, System.Threading.Tasks.ValueTask<bool>> discoveryCallback) Line 137	C#
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Xunit.v3.InProcessFrontController.<Find>d__11>.ExecutionContextCallback(object s)	Unknown
 	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Xunit.v3.InProcessFrontController.<Find>d__11>.MoveNext(System.Threading.Thread threadPoolThread)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Xunit.v3.InProcessFrontController.<Find>d__11>.MoveNext()	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox box, bool allowInlining)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.TaskCompletionSource<object>.SetResult(object result)	Unknown
 	xunit.v3.core.dll!Xunit.v3.TestFrameworkDiscoverer<Xunit.v3.IXunitTestClass>.Find.AnonymousMethod__0(object _) Line 90	C#
 	System.Private.CoreLib.dll!System.Threading.QueueUserWorkItemCallback.Execute()	Unknown
 	System.Private.CoreLib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()	Unknown
 	System.Private.CoreLib.dll!System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()	Unknown
 	[Async Call Stack]	
 	[Async] xunit.v3.runner.inproc.console.dll!Xunit.Runner.InProc.SystemConsole.ConsoleRunner.EntryPoint(System.IO.TextReader consoleReader, System.IO.TextWriter consoleWriter) Line 227	C#
I deleted every test from the project and it still gets stuck on Analyse. I'm starting to wonder if I have some turds stuck in a pipe somewhere. Is there a way I can flush all NCrunch state out which may be specific to my system and not on yours?
I've managed to pin this down now. I'll update you soon.
Good to hear! Just in case it helps somehow because I was poking around already:

I nuked my .NCrunch_ folder, deleted all tests, and the net48 one seems to consistently get stuck. Also, I am seeing a weird state where the (N) logo stops churning even though it still has an item in the queue. It could indicate some kind of UI error too maybe 🤷.

Screenshot
Would you be interested in trying the build below to see if it solves the problem for you?

NCrunch_Console_5.13.0.1.msi
NCrunch_Console_5.13.0.1.zip
NCrunch_GridNodeServer_5.13.0.1.msi
NCrunch_GridNodeServer_5.13.0.1.zip
NCrunch_LicenseServer_5.13.0.1.zip
NCrunch_Rider_5.13.0.1.7z
NCrunch_Rider_5.13.0.1.zip
NCrunch_VS2010_5.13.0.1.msi
NCrunch_VS2010_5.13.0.1.zip
NCrunch_VS2012_5.13.0.1.msi
NCrunch_VS2012_5.13.0.1.zip
NCrunch_VS2013_5.13.0.1.msi
NCrunch_VS2013_5.13.0.1.zip
NCrunch_VS2015_5.13.0.1.msi
NCrunch_VS2015_5.13.0.1.msi.7z
NCrunch_VS2015_5.13.0.1.zip
NCrunch_VS2017_5.13.0.1.msi
NCrunch_VS2017_5.13.0.1.msi.7z
NCrunch_VS2017_5.13.0.1.zip
NCrunch_VS2019_5.13.0.1.msi
NCrunch_VS2019_5.13.0.1.msi.7z
NCrunch_VS2019_5.13.0.1.zip
NCrunch_VS2022_5.13.0.1.msi
NCrunch_VS2022_5.13.0.1.msi.7z
NCrunch_VS2022_5.13.0.1.zip
This is working great. I even enabled RDI for the net8 target and that also is working well. Thanks for the fix!
This post has been deleted.

Post a reply

Log in to reply.