the issue looks similar to
but has its own nuances:
We have a set of tests built over TestAPI v0.2, each test has tear-down method which calls App.Close(), where 'App' is OutOfProcess AutomatedApplication.
After switching to TestAPI v0.4 We've started to get following upon calling App.Close():
System.InvalidOperationException: Exception of type 'System.InvalidOperationException' was thrown.
at System.Windows.Automation.AutomationElement.GetCurrentPattern(AutomationPattern pattern)
at Microsoft.Test.ApplicationControl.UIAutomationApplicationImpl.CloseProcessWorker() in c:\dd\WPF_1\src\wpf\test\Infra\TestApi\TestApiWpf\Code\ApplicationControl\UIAutomationApplicationImpl.cs: line 250
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
Note: The work-around suggested in
(calling sampleAppPath.Replace("file:\", string.Empty)) doesn't work for our set of tests.
The issue is quite painful since we'd like to engage new features in TestAPI but we can't due to the issue.
Thank you in advance.