Activity Modify Text Error

I thought this issue was resolved by recreating the variable like suggested before but it did not resolve my issue. Unless I misunderstood your previous recommendation @Anil_G (Modify Text Activity Error). We are on Studio version 24.10.10

I am getting the below error after upgrading the UiPath.Systems.Activity package to 24.10.7. Its failing at the Modify Text activity. After downgrading back to UiPath.Systems.Activity package 22.10.6 the error cleared. I have tried 23.10.x, 24.10.x, and 25.2.1. Always fails unless downgrade back to 22.10.6.

If I just use an assign activity and use: fileName.Replace("", “”).Trim - It works just fine.
image

Odd that the Modify Text Activity would not work the same.

Other thought, would a persistent activity further down the workflow cause an issue like this?

System.Exception: Type ‘UiPath.Core.Activities.TextModifications.FindAndReplaceTextModificationModel’ cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required. —> System.Runtime.Serialization.InvalidDataContractException: Type ‘UiPath.Core.Activities.TextModifications.FindAndReplaceTextModificationModel’ cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required. at System.Runtime.Serialization.DataContracts.DataContract.DataContractCriticalHelper.ThrowInvalidDataContractException(String message, Type type)

@PWilliams

Lets try to check other possibilities now

May I know if filename is an object type or string?

As the error seems to be more with persistent activities as you rightly pointed..non serializable variables cannot be used

If the variable is string then we can try isolating this into a separate workflow or sequence so that its not in the persistent scope to see if the activity in different scope is causing the issue or not

Cheers

Yes, this is an error due to use of Persistence. Certain types of variables cannot be serialized. Serialization is what happens when the job suspends. It’s how the variables’ values are saved so they can be reinstated when the job resumes. You have to make sure it’s not in the same scope as the wait activity.

1 Like

fileName is type String.

1 Like

That is what I thought. Funny that it worked up until we upgraded Studio and then updated the dependencies.

Hi,

I can reproduce this matter using a simple workflow in my environment (Studio 24.10.10) as the following.

Before adding ModifyText, this error doesn’t occur.

I think it’s UiPath matter (Bug or Specification).

Regards,

@PWilliams

If string as mentioned try to insolate into separate sequence or workflow so that the scope would be different and it need not be serialized

I tried on 25.0 and I cannot replicate the issue but can try to use separate workflow or sequence for your case and check

Cheers

Could you please share xaml file to recreate the error?

I don’t think it’s an error with one of your variables. I think it’s an error with a variable or something inside the Modify Text activity. That’s why it works on an older version.