I am using ver 0.6.0012 C# components.
This newer version is very strict in casting types.
I have been fighting with "specified cast is not valid" error (without specifying which type to which type) for a while.
This was revealed to be caused by connecting Numberslider to Integer input. (Even if the Numberslider outputs integer, the type is double.)
check tobias' answer:
"I had the same problem a while ago, my solution was to change the hint of the input list "x" from double to Object and then cast the items back to double like so: sum = sum + (double) x[j];"
Thanks.
Right. I commented everything out, when I realized the problem is in input.
My solution for this was to bypass the control value through integer component so that the hint for the type is unchanged.