My project makes extensive use of the C# Async feature. Often I have to task.Wait() or
the equivilant for tasks that I need to complete before my test code resumes.
These tests succeed only intermittently. When they fail the stack trace looks like this:
*** Failures ***
Internal Error
System.Threading.ThreadAbortException: Thread was being aborted.
HResult: -2146233040
at Xunit.Sdk.ExceptionAndOutputCaptureCommand.Execute(Object testClass)
at Xunit.Sdk.TimedCommand.Execute(Object testClass)
at Gallio.XunitAdapter.Model.XunitTestController.RunTestCommandAndFinishStep(ITestContext testContext, ITestClassCommand testClassCommand, ITestCommand testCommand)
*** Failures ***
Internal Error
System.Threading.ThreadAbortException: Thread was being aborted.
HResult: -2146233040
at Xunit.Sdk.ExceptionAndOutputCaptureCommand.Execute(Object testClass)
at Xunit.Sdk.TimedCommand.Execute(Object testClass)
at Gallio.XunitAdapter.Model.XunitTestController.RunTestCommandAndFinishStep(ITestContext testContext, ITestClassCommand testClassCommand, ITestCommand testCommand)
Timeout of 1000 expired
Stack trace at point of timeout:
at System.Threading.WaitHandle.WaitOneNative(SafeHandle waitableSafeHandle, UInt32 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext)
at System.Threading.WaitHandle.InternalWaitOne(SafeHandle waitableSafeHandle, Int64 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext)
at System.Threading.WaitHandle.WaitOne(Int32 millisecondsTimeout, Boolean exitContext)
at System.Threading.WaitHandle.WaitOne()
at Melville.Library.SynchronousAwaiter.TaskPumper.ExclusiveSynchronizationContext.BeginMessageLoop() in C:\Users\John\Documents\Code\PhotoDoc\Melville.Library\SynchronousAwaiter\TaskPumper.cs:line 109#0
at Melville.Library.SynchronousAwaiter.TaskPumper.Run(Func`1 item) in C:\Users\John\Documents\Code\PhotoDoc\Melville.Library\SynchronousAwaiter\TaskPumper.cs:line 32#1
at PhotoDoc.Test.DataModel.Photos.PhotoSheetTest.<ImportImage>d__15.MoveNext() in C:\Users\John\Documents\Code\PhotoDoc\PhotoDoc.Test\DataModel\Photos\PhotoSheetTest.cs:line 75#2
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at PhotoDoc.Test.DataModel.Photos.PhotoSheetTest.ImportImage()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Xunit.Sdk.Reflector.ReflectionMethodInfo.Invoke(Object testClass, Object[] parameters)
at Xunit.Sdk.FactCommand.Execute(Object testClass)
at Xunit.Sdk.FixtureCommand.Execute(Object testClass)
Any ideas how to remedy this?
Thanks
JDM
Remco NCrunch Developer
#4122
07 May 2013 08:35 UTC
Hi, thanks for posting!
From the description shown, it looks like NCrunch or Xunit is enforcing a timeout of 1000 on your tests. Because the tests are asynchronous and involve waiting between threads, it's possible that while your system is under load, the test takes longer than 1000ms to execute and is therefore aborted during the test run.
Are you making use of any attributes to specify this test timeout? If not, have a look at the default test timeout project-level NCrunch configuration setting to see if this has been set lower than it should be.
From the description shown, it looks like NCrunch or Xunit is enforcing a timeout of 1000 on your tests. Because the tests are asynchronous and involve waiting between threads, it's possible that while your system is under load, the test takes longer than 1000ms to execute and is therefore aborted during the test run.
Are you making use of any attributes to specify this test timeout? If not, have a look at the default test timeout project-level NCrunch configuration setting to see if this has been set lower than it should be.
Post a reply
Log in to reply.