Can't correctly pass collections to Invoke Code

collections
studio
arguments
invoke
invoke_code

#1

Hello.

I initialize two collections in the arguments panel and another one collection via ‘Assign’ activity. Inside the flowchart I use invoke code to perform some simple VB operations with those collections. But the problem is that it always pass null objects to Invoke Code. What am I doing wrong?

The error message is:

Invoke code Compare collections : Exception has been thrown by the target of an invocation.

The .xaml file is attached.

P.S. The same VB code worked absolutely correctly in Visual Studio.

Main.xaml (10.7 KB)


#2

Hi @MGMKLML

The error is because trashlist is given as an Out Argument. Change it to In/Out.


#3

No, unfortunately, it doesn’t help. Same error.


#4

@MGMKLML

@ovi’s solution does work. Changing to In/Out should be done in Invoke Activity, not in the Main.xaml argument. Here is the working XAML.
Main (2).xaml (11.0 KB)


#5

Thank you. It’s a very strange this as I did exactly the same, I changed to In\Out in the Invoke Code activity but it threw me the error. Your .xaml does work. A really strange thing.
Why do I have to switch it to In\Out though? Could you explain? Were it an integer I would’ve made it just Out and would’ve worked.


#6

@MGMKLML

If the argument is marked OUT then trashlist is not Passed into the Invoke Code (basically what you assigned in the Assign activity isn’t passed), but the Out value of trashlist from the Invoke Code is passed.