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