Unlike Rules, which are configuration-based (see Rules Engine), User Functions are compiled code. They follow a strict lifecycle to ensure stability on the factory floor.
Lifecycle Stages
1. Build
When you click Build in the code editor, the Management Console sends your code to the compiler service.
- Syntax Check: Verifies C# syntax correctness.
- Compilation: Compiles the code into a DLL in memory.
- Result: If successful, the status changes to
Built. If failed, compiler errors are displayed in the output window.
2. Deploy
After a successful build, you must Deploy the function to specific Gateways.
- Select target Gateway(s).
- The system pushes the compiled binary to the Edge agent via the secure deployment channel.
- The Gateway loads the assembly into its
PluginManagerand executesOnStart().
3. Undeploy
To stop a function, click Undeploy. The Gateway will immediately unload the assembly and stop processing messages for that specific script.
Debugging with Logs
Since functions run on remote hardware, you cannot attach a debugger (like Visual Studio). Instead, you rely on the Live Log Stream.
Navigate to Functions > Logs to see real-time output from your scripts. For more information about system logs, see System Logs.
- draft Console Output
Use LogInformation(), LogWarning(), and LogError() in your code to categorize messages. You can filter the log stream by these levels in the UI. For more about the SDK capabilities, see SDK Reference.