[Custom Activities] VisualBasicValue results in Unsupported Expression in C# projects

Hi there,

I’m creating custom activities and always tested it in projects using Visual Basic language.

Now I’m testing using C# language and I am getting “Unsupported Expression” in all parts of my Custom Activities where I set the value using VisualBasicValue.

To get this working, I need to change from VisualBasicValue to CSharpValue, but of course this will just switch the problem making projects in Visual Basic language have the same problem.

There is a way to determine in design time which language source is being used by UiPath in order to choose the right approach? (VisualBasicValue / CSharpValue).

For Visual Basic language projects:
TextEncoding = new VisualBasicValue<Encoding>("System.Text.Encoding.UTF8")

For C# language projects:
TextEncoding = new CSharpValue<Encoding>("System.Text.Encoding.UTF8")

had you tried to work directly with the constructor e.g. like:

Hi @ppr ,

I’m developing custom activities in Visual Studio. Maybe in the example given I was not clear so let me give another one.

Lets take for example a well know package (I think) from Marketplace.

  • UiPathTeam.DotNetZip.Activities.

This package provide us two activities (Compress and Extract):

Selecting multiple files with Compress activity, we get the follow expression in ToCompress property:

Now, if you try to use the same package in a C# project, the expression is unsupported:

Ok, but why this is happening?

Here is the problem:

Like me, the developer who made this activity is also using the same approach.

He is building and expression to represent an array of strings, but just for Visual Basic language.

For C#, we need use CSharpValue and in the expression where is "new String()" we need change to "new string[]".

But, we don’t have ways to know which we should use and that is my question.

It seems the official packages of UiPath uses a class called ArgumentFactory to deal with that, see the method bellow:


But this is an internal class and we don’t have access to it.

So, for now I’m stuck in provide custom activities to C# project that works properly.

By the way, the package that I created is called Autossential and can be found in Marketplace and in NuGet.