I have a custom activity package that defines a class by the name AdUserAttribute. There’s nothing special about the class, just a couple of auto-properties of built-in types and two class constructors.
Class
public class AdUserAttribute
{
public string Name { get; }
public string[] Values { get; }
public AdUserAttribute(string key, string value)
{
Name = key;
Values = new string[] { value };
}
public AdUserAttribute(string key, string[] values)
{
Name = key;
Values = values;
}
}
I can use individual AdUserAttribute
instances in UiPath no problem. However, one of the activities in the package takes a regular C# array of AdUserAttribute
s as input. Now, the moment I define a variable of type AdUserAttribute[]
in the workflow, starting the workflow fails with the exception Cannot create unknown type...AdUserAttribute[]
.
I should also note there’s no Orchestrator involved. I’m only testing a workflow that’s using the custom activity package locally. The UiPath version installed is 2018.1.3.
Exception
Main has thrown an exception
Source: System.Xaml
Message: Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CustomActivities.ActiveDirectory;assembly=CustomActivities}AdUserAttribute[])'.
Exception Type: XamlObjectWriterException
System.Xaml.XamlObjectWriterException: Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CustomActivities.ActiveDirectory;assembly=CustomActivities}AdUserAttribute[])'.
at System.Xaml.XamlObjectWriter.WriteStartObject(XamlType xamlType)
at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
at System.Activities.XamlIntegration.FuncFactory`1.Evaluate()
at System.Activities.DynamicActivity.OnInternalCacheMetadata(Boolean createEmptyBindings)
at System.Activities.Activity.InternalCacheMetadata(Boolean createEmptyBindings, IList`1& validationErrors)
at System.Activities.ActivityUtilities.ProcessActivity(ChildActivity childActivity, ChildActivity& nextActivity, Stack`1& activitiesRemaining, ActivityCallStack parentChain, IList`1& validationErrors, ProcessActivityTreeOptions options, ProcessActivityCallback callback)
at System.Activities.ActivityUtilities.ProcessActivityTreeCore(ChildActivity currentActivity, ActivityCallStack parentChain, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)
at System.Activities.ActivityUtilities.CacheRootMetadata(Activity activity, LocationReferenceEnvironment hostEnvironment, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)
at System.Activities.Hosting.WorkflowInstance.ValidateWorkflow(WorkflowInstanceExtensionManager extensionManager)
at System.Activities.Hosting.WorkflowInstance.RegisterExtensionManager(WorkflowInstanceExtensionManager extensionManager)
at System.Activities.WorkflowApplication.EnsureInitialized()
at System.Activities.WorkflowApplication.Enqueue(InstanceOperation operation, Boolean push)
at System.Activities.WorkflowApplication.SimpleOperationAsyncResult.Run(TimeSpan timeout)
at System.Activities.WorkflowApplication.BeginRun(AsyncCallback callback, Object state)
at UiPath.Executor.RobotRunner.<>c__DisplayClass51_0.<OnInvokeJob>b__0()
What gives? I mean, if UiStudio can use a type as it is, how come using it as an array type blows up?
EDIT: Only using the array appears to suffer from the issue. Using List(Of AdUserAttribute) works just fine.
EDIT2: In UiPath version 2018.4.4 also the array works. To me, this seems like a bug in older version.