Custom Library - The argument of type 'System.String' cannot be used. Make sure that it is declared on an activity

Good afternoon, I have a problem with my RPA. It turns out that I have a for each loop, with the type argument correctly set. The problem is that in iteration 0, it works correctly, but in the second iteration, I get this error.

image

This is a library from a Salesforce connector, where I am only extracting by argument Case (in - String), Status (out - String).

If you can help me, I would appreciate it because I don’t know why it could be giving me this error the second time the activity in the activity is executed.

@manuel.vilchez

Welcome to the community

Can you please show a clear picture of what uou are doing…what activity it is and what values are passed?

Also can you check exception details and variable values from locals panel in debug mode when error occurs to know the clear data present

Cheers

Your Screenshot is not clear you need to give us a new one

@manuel.vilchez now lets us on your error message part, it looks like the issue is on the input parameter stage.

This error in UiPath custom activity development arises due to a mismatch between the type of data you’re providing for an argument and the type the argument is expecting in your custom activity.

Breakdown of the Error Message:

  • “The argument of type ‘System.String’” : This indicates you’re passing a string value (text data).
  • “cannot be used. Make sure that it is declared on an activity” : This implies the argument you’re trying to use isn’t declared on the activity itself or it’s expecting a different data type.

Potential Causes and Solutions:

  • Incorrect Argument Declaration:
  • Mismatched Data Assignment in UiPath Studio
  • Incorrect Custom Library Usage (if applicable): if you using existing salesforce custom activity pls read a document

if you have created your own custom activity pls check the below link

I’m experiencing the same thing on a custom library that has been working fine for years.

It’s inside of a Robotic Enterprise Framework, and everything works fine on the first processed queue item, but on the second and every subsequent, I get the error.

The library is for interacting with my Gsuite account, and the error pops up whether I’m sending an email, reading a sheet, or uploading a file to a Gdrive folder.

I have verified that all of the inputs are correct. If I run the exact same queue item as a first item, it goes through fine with no errors.

There’s something wrong here and it isn’t developer error.

@manuel.vilchez did you ever figure this out? I am having the same issue and my activity does not have any string arguments

As someone who develops my own libraries for UiPath, I too have run into this issue.

Most common causes:

  1. Cross-language (C# library being used by a VB .NET Robot). It’s supposed to just work but sometimes it doesn’t.
  2. No direct target - If you’re building for a Windows Legacy robot, you need to make sure that you multi-target NetStandard2.0 as well as whatever NET46X version you wish to suppport. Otherwise UiPath will throw this exception. I typically multi-target for NET462, NetStandard2.0, Net6.0, Net7.0, and Net8.0.

Important Note
Despite compatibility tables stating otherwise, NET461 and NetStandard 2.0 are not compatible. They were at one point, but there is now a bug that Microsoft has yet to fix (and likely won’t because NetStandard is out of support). So if you’re building strictly for NetStandard2.0 in the hopes of covering everything, try adding an explicit NET461 and NET462 targets.