For me i am not getting any error the code is working fine. i think the error is due to UiPath.System.Activities package is older version i guess. if you have older version could you pls upgrade to latest. Please note that before doing all this pls take back up of your project and do all these changes.
After upgrade to latest try execute that invoke code activity. thanks
I have only one extra package other than default packages. that is below
@prasath_S : i am able to run your code in my studio. But @Shilpa_Mohanty is not able to execute the invoke code you have provided. could you help on this.
I just tried the code sequence and it works fine for me, for Windows - Legacy and Windows mode, with UiPath Studio 2021.10.2.
The class Microsoft.CodeAnalysis.SyntaxTree with the method ParseText is part of the Roslyn compiler. It is part of the Studio installation and in a normal case I would never expect this kind of error.
Here as example my two test cases, please try it and let us know your results. ShilpaTestWindows.zip (99.9 KB) ShilpaTestWindowsLegacy.zip (56.6 KB)
Extract this files in your C:\Users[YourUserName]\Documents\UiPath folder and open the project file from the front page of the UiPath Studio. Does the exclamation mark appear in the upper right corner of the Invoke Code activity?
I haven’t get the exact conditions for reproduction yet, but In Studio 20.10.9 with System.Activities package 21.10.2 this occurs. If downgrade System.Activities package to 20.10.4 (this is bundled version of Studio 20.10.9) , there is no error.
So for now can you try to downgrade System.Activities package to 20.10.4, if you use Studio except the latest.
Hello Yoichi,
thank you very much for sharing. Very interesting aspect. It could be be possible that the “older” Studio release doesn’t contain the Roslyn compiler, that would explain everything.
Best regards
Stefan
In case you haven’t I will suggest to use the expression mentioned is my post referred in here:
Create an invoke code with one argument in/out named InitialDT and as value give your table containing the values (83 columns)
InitialDT.AsEnumerable.Where(Function (c) c(“<Name of the column>”).Equals(“”)).Select(Function(c)
c(“<Name of the column>”)=“0”
Return c
End Function).ToList()
Replace the “<Name of the column>” with your column name (the one you would like to replace the values)
Replace - Equals(“”) with Equals(“-241”)
if the column is of other type than string you can add the .ToString like this:
InitialDT.AsEnumerable.Where(Function (c) c(“<Name of the column>”).ToString.Equals(“”)).Select(Function(c)
c(“<Name of the column>”)=“0”
Return c
End Function).ToList()
Copy the invoke 3 times and change the mane of the column.
In this case the only solution for you is to use a combination of Linq expresions.
First - Do you have a unique ID in your table that can be used for merge?
If the first is yes you can split the table in two.
One part to contain the columns you would like to replace the values in and the UniqueID
Second one with the rest of the columns and the UniqueID.
Use the Linq expression in my post to replace the values
Use a second Linq expression to merge back the columns.
You can do the split and merge with standard UiPath activities also so is your decision.
P.S. If you don’t have an UniqueID you can generate it.