Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

xxx.Wait causes intermittent timeout exception
Melville
#1 Posted : Tuesday, May 7, 2013 4:05:42 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/7/2013(UTC)
Posts: 1
Location: United States of America

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
#2 Posted : Tuesday, May 7, 2013 8:35:24 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
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.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download