I want to run a TestStand sequence via .NET API in C#. I'm currently doing as follows:
Engine tsEngine = new Engine();
SequenceFile testSequenceFile = tsEngine.GetSequenceFileEx(pathToMySequence);
SequenceFile processModelSequenceFile = tsEngine.GetSequenceFileEx("MyProcessModel", GetSeqFileOptions.GetSeqFile_FindFile, TypeConflictHandlerTypes.ConflictHandler_Error);
Execution tsExecution = tsEngine .NewExecution(testSequenceFile, "MainSequence", processModelSequenceFile, false, 0);
var result = tsExecution.WaitForEndEx(1000);
Everything works fine, and WaitForEndEx returns true.
How can I wait for execution end in an async way? If I run WaitForEndEx in a separate Task it always time outs (example next line).
Task.Run(() => tsExecution.WaitForEndEx(1000));
Thanks.