Jump to: navigation, search

Difference between revisions of "Debugger"


Line 24: Line 24:
  
 
==Code==
 
==Code==
 +
The code tab is 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.
 +
 +
The sample code will iterate through all objects passed as input parameters and print their Name and Description to the debug output:
 +
<source lang="csharp">
 +
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");
 +
}
 +
}
 +
}
 +
</source>
  
 
==Workflow==
 
==Workflow==

Revision as of 09:44, 23 October 2013

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

Parameter section

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 is 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.

The 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

Output & Debugging section