Lamba expression not working in an If condition in a C# process

Studio giving ‘Expression expected’ error for the below mentioned expression.
myDataDict.Any(x => x.Value.Equals(“”))

@rajatsingla28
Welcome to the forum

Unfortunately you had not shared the validation message and the detail dictionary datatype.

Try following:
myDataDict.Any(x => String.IsNullOrEmpty(x.Value.ToString().Trim()))

grafik

When using UiPath.System.Activities in version 20.X.X we can encounter some strange behaviour. Maybe you can also update the different package versions for checks (Take backups before)

Hello Peter
Thanks a lot for the input.
I tried with the expression mentioned above but still getting the error. PFA the screenshot.

which version is in use. Also share a screenshot of the properties from the if acitvity. Thanks

Studio - 2021.10.6
iPath.System.[Activities] - 22.4.1

Also, I just noticed a very very strange thing. If I add a new file ‘test.xaml’ to the project and then add the If activity in that, Studio does not give any error(I did not change any package version/dependency).
Studio gives the error only in Main.xaml file.
PFA the screenshot.

another example as we encountered some surprisings. However when you get it running e.g. with delete activity, rebuild then its better for the next implementations. as dict datatype is of string, string the used ToString() can be removed as it is unneded

I have tried deleting, rebuilding several times but got same result every time.
Not sure of the real issue as I am facing the same error while I try to access the column value from a datatble(code segment working in a xaml file other than Main).

Thanks a lot for the inputs.

@rajatsingla28 ,

Is it possible for you to Provide that particular xaml file? We could Check if it can be replicated from our end.

Hello
sorry, I am unable to attach the file. It gives me error that ‘New users cannot upload attachments.’

Your main workflow seems to be set to VB so C# expression won’t work there.

image

Hello
Thank you for pointing this out.
But my project is set to C#. Not sure how the Main is set to VB. Any idea on how to reset this behaviour?
image

Have you tested to create a new xaml file and copy and paste the sequences?

The only way I know of that could cause this issue is if someone copied a xaml file from a VB-project and put it in a C# -project.

The new xaml files being added to the project are set to C#. Will create new file Main.xaml and delete the existing one.

Thanks a ton @ptrobot for figuring out this glitch.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.