Try + Catch Macrooloop killing itself
Posted: Wed Sep 15, 2021 4:37 pm
Hey folks
I'm having an issue with a macroloop that is shutting itself down (meaning the macro finishes, then shuts down within UCCNC and stops looping).
Short of posting the entire macro I will say that it has everything to do with try + catch combos. Every time I do a try and an exception is thrown it will execute the 'catch' code then rather than restarting the macro it just get's 'killed', stops looping, and isn't running when I check on it in macroloop window.
Has anyone else experienced this? It's happening with every try + catch I do, no matter what they are doing. So for example:
double GetDouble(string TempString){
try {
TempDouble = Convert.ToDouble(TempString);
return TempDouble;
}
catch(FormatException ex) {
MessageBox.Show("Caught exception in GetDouble method.");
return;
}
}
In this example the "Caught exception" messagebox will show, then as soon as I click 'ok' the macro shuts down and stops looping. If I ask it to show a messagebox in the parent method AFTER the method is called it will not. The whole thing breaks at that last 'return' in the catch (whether I tell the method to return a value or not). Is there some system exception handling within UCCNC I should know about? Looking to have this macroloop catch exceptions, handle them, then continue looping.
Best
I'm having an issue with a macroloop that is shutting itself down (meaning the macro finishes, then shuts down within UCCNC and stops looping).
Short of posting the entire macro I will say that it has everything to do with try + catch combos. Every time I do a try and an exception is thrown it will execute the 'catch' code then rather than restarting the macro it just get's 'killed', stops looping, and isn't running when I check on it in macroloop window.
Has anyone else experienced this? It's happening with every try + catch I do, no matter what they are doing. So for example:
double GetDouble(string TempString){
try {
TempDouble = Convert.ToDouble(TempString);
return TempDouble;
}
catch(FormatException ex) {
MessageBox.Show("Caught exception in GetDouble method.");
return;
}
}
In this example the "Caught exception" messagebox will show, then as soon as I click 'ok' the macro shuts down and stops looping. If I ask it to show a messagebox in the parent method AFTER the method is called it will not. The whole thing breaks at that last 'return' in the catch (whether I tell the method to return a value or not). Is there some system exception handling within UCCNC I should know about? Looking to have this macroloop catch exceptions, handle them, then continue looping.
Best