I'm trying to replace the RunTime Error dialog with a customized dialog. The customized dialog will have the same options as the original dialog and some additional stuff. I attached an event handler to ApplicationMgr.BreakOnRunTimeError event but I don't know what's the correct way to mimic the behavior for the runTimeErrorAction.
I'm currently doing this:
var frameID = 0;
var sequenceContext = e.initiatingThread.GetSequenceContext(0, out frameID);
sequenceContext.SequenceErrorMessage = message;
sequenceContext.SequenceErrorOccurred = true;
sequenceContext.ErrorReported = true;
sequenceContext.GotoCleanup = true;
This makes the execution goes to cleanup and the sequence file will show Passed. The original behavior makes the execution shows Error.
sequenceContext.NextStepIndex = sequenceContext.StepIndex;
This has no effect.
This is working fine.
Anyone can help with this?
Solved! Go to Solution.
If you are handling the BreakOnRunTimeError event, you don't need to write the code to do these things, the ApplicationMgr does them for you. You just need to set the showDialog parameter to false so the ApplicationMgr won't show its dialog and set execution.RTEOptionForThisExecution to whichever option you want it to implement.
Hope this helps,
In looking at this more carefully, it appears that the BreakOnRunTimeError event does not work the way I thought it did (and probably not the way it was intended). Setting execution.RTEOptionForThisExecution has the side-effect of keeping the dialog from ever being displayed again. I've reported this issue for further consideration. To workaround this issue, the easiest thing you can do is to handle the AfterUIMessageEvent and reset RTEOptionForThisExecution back to RTEOption_ShowDialog, similar to the following:
private void axApplicationMgr_AfterUIMessageEvent(object sender, NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_AfterUIMessageEventEvent e)
if (e.uiMsg.Event == UIMessageCodes.UIMsg_BreakOnRunTimeError)
e.uiMsg.Execution.RTEOptionForThisExecution = RTEOptions.RTEOption_ShowDialog;
Your BreakOnRunTimeError handler would look something like the following:
private void axApplicationMgr_BreakOnRunTimeError(object sender, NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_BreakOnRunTimeErrorEvent e)
e.breakExecution = mydialogsbreakexecutionsetting;
e.showDialog = false; // Don't show the application manager's dialog
e.exec.RTEOptionForThisExecution = mydialogsrteoption;
Hope this helps,