Jump to: navigation, search

Debugger


The Code- and Workflow Debugger (aka Who-Bert) is a tool primarily meant for testing, tracing and debugging. It is able to execute C# code on the fly and can also be used to run and trace workflows.

Toolbar

Item Purpose
Run Runs the code or workflow synchronously (in the main thread); execution will block the debugger until it is finished
Run async Runs the code or workflow asynchronously (in a separate thread); execution will happen in the background and the debugger will not be blocked

Parameters

Input parameters

A list of input parameters to the code or workflow is located in the top left corner of the debugger. This list will be passed as

  • Code: a parameter array to the method TestObject of all Values in the list, named InVariables
  • Workflow: a dictionary of InArguments (string, object) where each Parameter in the list is the key and each Value is the value
IC Hint square.pngThe default workflow (emtpy canvas) always expects an InArgument named UBIKObject (and therefore an input parameter named accordingly), its value can be null though if you don't need it

Simply start typing in a new cell of the Parameter column to create a new parameter and assign a value by either typing in the Value cell (i.e. for passing a string) or Drag&Drop an object from a UBIK® Control to pass an object to the code or workflow.

Output parameters

A list of output parameters returned by the workflow as a dictionary of OutArguments (string, object). If the workflow doesn't return anything this list will stay empty.

Code

The Code tab can be used to write and execute C# code using a standard Coding box. By default it will come up with sample code for a class named ObjectTest and a method named TestObject. On execution it will compile the code, instantiate a new class ObjectTest and invoke the method TestObject, therefore all the code in the body of TestObject will be executed as well.

This sample code will iterate through all objects passed as input parameters and print their Name and Description to the debug output:

using System;
using System.Windows.Forms;
using UBIK.Kernel;
using UBIK.Runtime;
using UBIK.Runtime.Sys;
using UBIK.Compiler;

namespace Studio
{
        public class ObjectTest
        {
                public void TestObject (params BaseClass[] InVariables)
                {
                        //Example using static class debugger
                        Debugger.Output(this, "*** Started");
                        foreach (BaseClass obj in InVariables)
                        {
                                Debugger.Output(this, obj.Name + " " + obj.Description);
                        }
                        Debugger.Output(this, "*** Finished");
                }
        }
}

Workflow

The Workflow tab is to design and execute workflows using a standard workflow designer

Output & Debug section

The output section is a tab page on the bottom of the debugger and displays messages from either the C# compiler or the workflow engine. New messages will always be added to the end and the debugger does never clear messages on its own. If you want to get rid of historical messages simply enter the output section and use Del to delete text.

The debug section can be used to print custom messages for the sake of debugging your code/workflow. If you want to get rid of historical messages simply enter the debug section and use Del to delete text.

Debug messages in code

To print messages to the debug tab use the static class Debugger in your code like in the following example:

Debugger.Output(this, "Hello, World!");

Debug messages in workflow

To print messages to the debug tab use the DebugMessage activity from the category UBIK ControlFlow