Function IsNumeric suddenly happen error "cannot refer to an instance member of a class..." when process moved to Testing Environment

Hi everyone,

I got this error in IsNumeric() when the process finished and moved to Testing Environment for Trial run.

At first I thought the reason is due to my String Array Variable “StringArray” because it’'s declared the size dynamically.

After I analyze, the problem seems came from IsNumeric().
Even I changed it to the simple syntax like: IsNumeric(“100”), it also has the same error message.

Does anyone know the reason or where I’m incorrect?

Thanks in advance.

I found this topic had same issue as mine.

According to his final solution, I also changed my code from
"IsNumeric(StringArray(StringArray.Count-1).ToString)"
to
"(StringArray(StringArray.Count-1).ToString).IsNumeric"
and it works.

But I still want to know the exactly reason, could anyone can share any comment?

Thanks Community!

2 Likes

Please remember that this is a .net function and not to do with uipath, first you need to ensure you dont have empty values or white spaces in your array, also avoid using ToString for objects that are already strings… you could use something like Integer.TryParse() for more compability and less trouble…

1 Like

I see that it is working if we use the class name, as well:
Information.IsNumeric
And looks like it is related to the version of UiPath.System.Activities package. In version 19.10.1, we can simply use IsNumeric, but starting with UiPath.System.Activities 20.2.0 it gives that error unless we use it as Information.IsNumeric.

3 Likes

@Silviu
Thanks for your sharing! It’s really useful information I believe.
I’m truly curious why the different version results in this situation.

1 Like

Please mark this as the solution :slight_smile: