Hello,
We experience random test failures while running Silverlight tests based on Telerik Test Studio. While the tests pass, just after a test finishes it receives an error saying 'The agent process was stopped while the test was running'. Most of the time tests pass, but about 5% of them fail with this error.
We are running tests via MSTest 2012 from a TeamCity build step. The test studio version is 2012.2, the machine is running Windows 8.1 x64
The following error occurs immediately in the Event Log:
Log Name: Application
Source: .NET Runtime
Date: 8/22/2014 12:58:53 PM
Event ID: 1026
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: X
Description:
Application: QTAgent32_40.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Threading.ThreadAbortException
Stack:
at MS.Internal.Automation.WinEventWrap.WinEventReentrancyFilter(Int32, Int32, IntPtr, Int32, Int32, Int32, UInt32)
at MS.Win32.UnsafeNativeMethods.PeekMessage(MSG ByRef, HWND, Int32, Int32, Int32)
at MS.Internal.Automation.QueueProcessor.WaitForWork()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
I tried debugging remotely and attaching VS to QTAgent32_40 process. When the exception occurs, the thread it occurs on is named 'MS UI Automation event queue processor.' Besides, there is always another thread named like 'Agent: adapter run thread for test 'X'...' with the following call stack:
mscorlib.dll!System.AppDomain.Unload(System.AppDomain domain)
ArtOfTest.WebAii.Design.dll!ArtOfTest.WebAii.Design.Execution.TestAppLoader.Dispose()
ArtOfTest.WebAii.Design.dll!ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteTest(ArtOfTest.WebAii.Design.Execution.ExecuteTestCommand command)
ArtOfTest.WebAiiVSIP.dll!ArtOfTest.WebAiiVSIP.WebAiiTestAdapter.Run(Microsoft.VisualStudio.TestTools.Common.ITestElement testElement, Microsoft.VisualStudio.TestTools.Execution.ITestContext testContext)
Microsoft.VisualStudio.QualityTools.AgentObject.dll!Microsoft.VisualStudio.TestTools.Agent.AgentExecution.CallAdapterRunMethod(object obj)
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state)
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.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart(object obj)
So it looks like if a test finishes in a bad moment, its attempt to unload app domain leads to async thread abort on UI Automation Client thread. It is not handled, so it causes process termination. (See for example http://stackoverflow.com/questions/9416078/how-to-handle-appdomain-unload-and-the-related-threadabortexception)
Is there anything that can be done to mitigate the issue? Or do I need to file a bug via our license holder? This error makes our automated UI tests unstable and unusable.
We experience random test failures while running Silverlight tests based on Telerik Test Studio. While the tests pass, just after a test finishes it receives an error saying 'The agent process was stopped while the test was running'. Most of the time tests pass, but about 5% of them fail with this error.
We are running tests via MSTest 2012 from a TeamCity build step. The test studio version is 2012.2, the machine is running Windows 8.1 x64
The following error occurs immediately in the Event Log:
Log Name: Application
Source: .NET Runtime
Date: 8/22/2014 12:58:53 PM
Event ID: 1026
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: X
Description:
Application: QTAgent32_40.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Threading.ThreadAbortException
Stack:
at MS.Internal.Automation.WinEventWrap.WinEventReentrancyFilter(Int32, Int32, IntPtr, Int32, Int32, Int32, UInt32)
at MS.Win32.UnsafeNativeMethods.PeekMessage(MSG ByRef, HWND, Int32, Int32, Int32)
at MS.Internal.Automation.QueueProcessor.WaitForWork()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
I tried debugging remotely and attaching VS to QTAgent32_40 process. When the exception occurs, the thread it occurs on is named 'MS UI Automation event queue processor.' Besides, there is always another thread named like 'Agent: adapter run thread for test 'X'...' with the following call stack:
mscorlib.dll!System.AppDomain.Unload(System.AppDomain domain)
ArtOfTest.WebAii.Design.dll!ArtOfTest.WebAii.Design.Execution.TestAppLoader.Dispose()
ArtOfTest.WebAii.Design.dll!ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteTest(ArtOfTest.WebAii.Design.Execution.ExecuteTestCommand command)
ArtOfTest.WebAiiVSIP.dll!ArtOfTest.WebAiiVSIP.WebAiiTestAdapter.Run(Microsoft.VisualStudio.TestTools.Common.ITestElement testElement, Microsoft.VisualStudio.TestTools.Execution.ITestContext testContext)
Microsoft.VisualStudio.QualityTools.AgentObject.dll!Microsoft.VisualStudio.TestTools.Agent.AgentExecution.CallAdapterRunMethod(object obj)
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state)
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.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart(object obj)
So it looks like if a test finishes in a bad moment, its attempt to unload app domain leads to async thread abort on UI Automation Client thread. It is not handled, so it causes process termination. (See for example http://stackoverflow.com/questions/9416078/how-to-handle-appdomain-unload-and-the-related-threadabortexception)
Is there anything that can be done to mitigate the issue? Or do I need to file a bug via our license holder? This error makes our automated UI tests unstable and unusable.