08-07-2013 03:17 PM
I am developing a fully custom operator UI for TestStand 2012 SP1 (without ActiveX / ApplicationMgr etc; I know, I know...). I'm trying to handle UIMsg_BreakOnRunTimeError appropriately and need advice.
1) My first issue is that I'm calling DisplayRunTimeErrorDialogEx() with the appropraite SequenceContext, however the dialog disables several of the options. Under Handle Current Error, Retry, Ignore and Abort Immediately (no cleanup) are grayed out (disabled) as well as the Break checkbox. With the same sequence SequenceEditor and the sample op UI display this dialog properly. Any ideas on what's causing this?
2) Secondly, how best to handle the user's selections? dontShowAgainForExecution, dontShowAgainForBatch, and suspendExecution seem straightforward enough per the documentation. i.e.
if (dontShowAgainForExecution) execution.RTEOptionForThisExecution = RTEOptions.RTEOption_Continue; if (dontShowAgainForBatch) thread.SetBatchRTEOption(RTEOptions.RTEOption_Continue); if (suspendExecution == false) execution.Resume(); // Correct? The execution seems already paused. What to do if this value is true?
Now what about runTimeErrorAction? I assume for RTEOption_Abort I call execution.Abort(). What are the proper steps for RTEOption_Continue, RTEOption_Ignore, RTEOption_Retry, & RTEOption_ShowDialog?
3) Lastly, once the dialog is closed, my execution completes with the result status Passed rather than Error. What's going on here?
Your help is appreciated as always,
-- Terrence Jones
Solved! Go to Solution.
08-08-2013 09:18 AM
1) This is likely due to user privileges, you are likely either not logged in with a user at all or the user does not have debugging privileges. If you don't want to use users you can disable privilege checking in the station options.
2) Something like this:
void ApplyRTESetting(TS::SequenceContextPtr sequenceContext, TS::RTEOptions rteOption, bool breakExecution)
{
TS::ThreadPtr thread = sequenceContext->Thread;
TS::ExecutionPtr execution = sequenceContext->Execution;
switch (rteOption)
{
case TS::RTEOption_ShowDialog:
case TS::RTEOption_Continue:
case TS::RTEOption_Abort:
thread->ClearTemporaryBreakpoint();
break;
default:
break;
}
// do action according to option selected
switch (rteOption)
{
case TS::RTEOption_Retry:
sequenceContext->NextStepIndex = sequenceContext->StepIndex;
thread->ClearCurrentRTE();
if (!breakExecution)
execution->Resume();
break;
case TS::RTEOption_Continue:
if (!breakExecution)
execution->Resume();
break;
case TS::RTEOption_Ignore:
thread->ClearCurrentRTE();
if (!breakExecution)
execution->Resume();
break;
case TS::RTEOption_Abort:
execution->Abort();
break;
}
}
Also for the other two settings we generally use the rteoption from the dialog rather than hardcoding continue, but you can make this work how you want if you prefer a different behavior:
Example:
if (dontShowAgainForExecution)
context->Execution->RTEOptionForThisExecution = rteOption;
if (dontShowAgainForBatch)
context->Thread->SetBatchRTEOption (rteOption);
3) Perhaps you are calling ClearCurrentRTE() for options other than ignore.
Hope this helps,
-Doug
08-08-2013 12:39 PM
Thank You...
You were right on with #1. And #2 looks like a great implementation.
As for #3, my problem was that I had assumed that Execution.ResultStatus should result in Error in the case of a RTE. I've instead begun checking Execution.ErrorObject instead as per your post here: Runtime error in process model and sequence still passes
Incidentally... when does Execution.ResultStatus result in ResultStatus_Error?
Thanks Again,
-- Terrence Jones
08-09-2013 10:08 AM
Incidentally... when does Execution.ResultStatus result in ResultStatus_Error?
Thanks Again,
-- Terrence Jones
Currently the execution status is always either Passed or Failed, Error is never set as the status for an execution.
-Doug
08-09-2013 01:41 PM
Hi,
Another option is to replace the NI dialog and error handling with a fully customized error handler of your own as demonstrated in the example, <Public>\Documents\National Instruments\TestStand 2010 SP1\Examples\Callbacks\PostStepRuntimeErrorCallback
cc
08-21-2013 05:05 PM
Hi, DowNow posted a link about replacing the error handler. I think I need to do something like that (because the 3rd party library I'm using throws exceptions that prints fine, has the embedded text, in C# but not in the TS Dialog). Where would I find the referenced document: <Public>\Documents\National Instruments\TestStand 2010 SP1\Examples\Callbacks\PostStepRuntimeErrorCallback
Thanks!
s
08-22-2013 09:08 AM
Find National Instruments\TestStand in your Program Files folder and in there should be a shortcut to Examples
08-22-2013 01:44 PM
Thanks Humphrey, I've seen that and used it now. I guess I'll have to create my own thread as this feature doesn't help with my problem.