Home 禄 Blog

Connect IoT Debug Code Task

 路 2 min 路 Jo茫o Roque

How To Debug Code Task

ConnectIoT Debug Code V10.1.0

This will be a how to, on debugging the code task.

Topics

  1. Overview
  2. How To

Overview

With the introduction of the code task, the need of customization has decreased substantially. Some of the complexity of customization has shifted to the code task. In software development, visibility and transparency on what is happening is essential, to better understand if the work fits the requirements and does not have undesirable side effects.

How To

Using the visual studio code as administrator we will debug the code task. In the code task add a hook debugger; this hook will provide a breakpoint for the appended execution of the visual studio code debugger to stop.

Adding Debugger Hook

Start the Automation Manager and open visual studio code and select F1. After selecting F1 a dropdown will appear, in this case we want to append to a node process, so select Debug: Attach to Node Process. It will show several node processes, the automation manager spawns at least 3 processes, one for the monitor, other for the driver and another for the controller. The code task is executed by the controller process, so that is the one we want to attach.

Attach Debugger

Now, whenever the code task is invoked it will stop in VS Code.






Author

Hello 馃憦 , my name is Jo茫o Roque 鉁岋笍

I’ve been working for some years at Critical Manufacturing. I split my time working in the IoT Team and working with the project’s teams. You can visit me at https://j-roque.com/ or check me at LinkedIn

Skills: Connect IoT / DevOps

Jo茫o Roque
IoT Developer Advocate