When I restart the WPF application with the following code:
ActiveApplication.Quit();
var runningApp = System.Diagnostics.Process.GetProcesses().Where(p => p.ProcessName == "WPFCalculator2");
Manager.LaunchNewApplication(@"D:\calculator\csharp\bin\Debug\AvalonCalculator2_WPF40Copy.exe");
Manager.ConnectToApplication(runningApp.FirstOrDefault());
the recorded is not able to attach again with RunToHere option and TS throws the following exception:
Outer Exception Type: System.ArgumentException
Message: Process with an Id of 13348 is not running.
HRESULT: 0x80070057 (Official ID (if app.) = E_INVALIDARG, Error Bit = FAILED, Facility = FACILITY_WIN32, Code = ERROR_INVALID_PARAMETER)
Call Stack:
at System.Diagnostics.Process.GetProcessById(Int32 processId, String machineName)
at System.Diagnostics.Process.GetProcessById(Int32 processId)
at Telerik.TestStudio.Wpf.WpfRecorderWindowManager.AttachRecorderToApplication(Int32 pid, Action`2 callback)
at ArtOfTest.WebAii.Design.DesignTimeExecution._runner_TestCompleted(Object sender, TestCompletedEventArgs e)
at ArtOfTest.WebAii.Design.Execution.RunnerController.OnTestCompleted(ExecutionReturnValues result)
at ArtOfTest.WebAii.Design.Execution.RunnerController.CallBackListener()
If we just execute the test it works smoothly and executes all the steps after the restarting.