rickj - 2022-02-28

We have been making great use of the initialization slot mechanism. The only downside is that bugs are extremely difficult to identify and locate. Often such bugs result in runtime exceptions leaving the log entries blank, with the only recourse being to remove code until the bug disappears and then add code back in. This can be slow and laborious as you masy well imagine.

Is there another debug method that is recommended or that can be used?

I would also like to humbly suggest a couple of possible future enhancements to make this process easier. The main problem is that initialization slots are executed immediately after download, so there is no chance of setting breakpoints.

The first thing that comes to mind is to have an option to defer initilization until the controler attempts to go online. This would allow breakpoints to be set at suspected code.

The second thing that comes to mind is to log the slot number and path of each item executed. This would at least identify the method being executed when the exception occurs.

My colleague and I are currently 6 hours into such a bug hunt today and still clueless about its location. Either or both of the above suggestions would have been imensely helpful today. Would codesys consider making these or alternative enhancement in a future version? Thank you very much for listening.