My TC and TE are both v.14. I upgraded both tools several days ago.
But before upgrade, when tools were v.12, same problem was there.
Here are my .Net codes.
public bool ConnectComObject()
{
try
{
TestExecuteObject = Marshal.GetActiveObject(TEProgID);
}
catch (Exception ex)
{
try
{
TestExecuteObject = Activator.CreateInstance(Type.GetTypeFromProgID(TEProgID));
}
catch (Exception e)
{
Application.DoEvents();
}
}
if (TestExecuteObject == null)
{
return false;
}
TestExecuteManager = (ITestCompleteCOMManager)TestExecuteObject;
IntegrationObject = TestExecuteManager.Integration;
Application.DoEvents();
return true;
}
First of the process, I call this method for start TE.
And call next code(it's a key part of full method), the variables such as 'param', 'projectName', 'unitName' are all has right value.(before this code I did validate variables value)
if (param == null)
{
IntegrationObject.RunRoutine(projectName, unitName, "Run");
}
else
{
IntegrationObject.RunRoutineEx(projectName, unitName, "Run", param.ToArray());
}
When all unit process finished, I release the com object.
public bool DisconnectCom()
{
try
{
TestExecuteManager.Quit();
var releaseResult = Marshal.ReleaseComObject(IntegrationObject);
IntegrationObject = null;
releaseResult = Marshal.ReleaseComObject(TestExecuteManager);
TestExecuteManager = null;
releaseResult = Marshal.ReleaseComObject(TestExecuteObject);
TestExecuteObject = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();
}
catch (Exception ex)
{
logger.Info("Exception : {0}", ex.Message);
return false;
}
return true;
}
The problem is that the next time I recall the first code(top code of here).
.Net project still run, and I have to recreate the TE process for next step.
Then the TE proccess created on windeow session but it becomes freeze status with indicator "Playback".
That indicator hang endlessly until manuallly kill the process.
I have to quit the process and restart it during the .Net program.
But I can't get any clue of this problem.
Once I thought it is related with rcw or ccw(it might be ccw..), but I don't know how control the ccw so please help me.
What I found out about ccw : https://docs.microsoft.com/en-us/dotnet/framework/interop/com-callable-wrapper