Cannot use UiPath activities via code

Hey,

So I’m not sure if I’m doing this incorrectly, or this just isn’t something supported with UiPath.

What I’m trying to do: Create a wrapper for all UiPath.System.Activities that accept a Dictionary<String, InArgument> so that we do not have to manually create those dictionaries in Studio, but can dynamically update them as the process develops. Currently, I’m only targetting Set Transaction Status and Add Log Fields.

I had difficulty in doing this and the steps below are for a Log Message activity.

Steps:

  1. lmActivity = new UiPath.Core.Activities.AddLogFields()
  2. activityArguments = new Dictionary(Of String, Object)
  3. lmActivity.Message = new InArgument((object)(“Testing…”))
  4. activityArguments(“Message”) = new InArgument((object)(“Testing…”))
  5. lmActivity.Level = new InArgument(LogLevel.Info)
  6. activitiyArguments(“Level”) = LogLevel.Info
  7. result = WorkflowInvoker.Invoke(lmActivity, activityArguments) → Error Here

The error I keep getting is “Assign: Object reference not set to an instance of an object.”

Check Robot API to invoke functionalities https://docs.uipath.com/robot/docs/robot-api. Do not try to wrap UiPath activities.