Cannot assign from type 'UiPath.Core.GenericValue' to type 'System.String' in Assign Activity

Before posting in this category make sure that you are an experience UiPath Developer. Please make sure you are not posting a question, problem, how to. There are other categories for that.

if we have Generic Variable called Description2 and we assigned the value like

Description2 = row(“Discripiton2”).ToString

after some time if we changed the Data Type of Description2 variable from Generic Value to String the following error is comming
Error : cannot assign from type ‘UiPath.Core.GenericValue’ to type ‘System.String’ in Assign Activity

anywhy we can solve by just remove the text from value box [row(“Discripiton2”).ToString ] and save the work flow and re enter the value it is solving , i think it s bug

it is Bug , Please Let me know if it is not bug

Hi @sudheern,
Are you using the newest packages version? I tested it and looks ok in my case:

If you are getting the error “Cannot assign from type ‘UiPath.Core.GenericValue’ to type ‘System.String’ in the Assign activity,” it means that you are trying to assign a value of type UiPath.Core.GenericValue to a variable of type string, which is not allowed.

One common cause of this error is trying to assign the output of an activity to a string variable without first converting the output to a string. For example, the following code would trigger this error:

Copy code

string myString;
myString = GetFullName.Output;

To fix this error, you need to convert the output of the GetFullName activity to a string before assigning it to the myString variable. You can do this using the ToString method:

Copy code

string myString;
myString = GetFullName.Output.ToString();

Alternatively, you can use the Assign activity with a type conversion:

Copy code

string myString;
Assign myString = (string)GetFullName.Output;