Invoke returns no argument if an exception was thrown

Hello.

The problem is that when you get an exception inside an invoked file it doesn’t return any “Out” or “In\Out” arguments.

What happens:
I have an In\Out argument, say, myArgument. In the main workflow it’s set to “String.Empty”. When I pass it to another workflow file I assign a value to the argument, say, myArgument = “MyString”.
Then it should perform some actions in this workflow and then end. But if an exception occurs inside the workflow file, it doesn’t renew the myArgument value. It was “String.Empty” before, it is still “String.Empty” after.

Do you have any ideas how to handle it?

Hi @MGMKLML

This thread might help you:

@loginerror Yeah I’ve already seen this topic. I thought there could be another solution :frowning: Thank you

Hi there,
I tested this in 2018.4.x with following result:

1/ in case the argument is one of primitive data types (e.g. string, int, etc.) the argument value is NOT returned from workflow in case of exception

2/ in case the argument is an abstract data type (e.g. JObject, dictionary, etc.) the argument value IS RETURNED from workflow in case of exception

Is this an expected result or just coincidence?

Cheers

1 Like

Hi,

I tried this with a dictionary(string,string) as an in/out argument and within the invoked process it errored out. The assigns I gave it in that invoked process did not carry through to the parent process unfortunately. How are you getting the argument value to return even in cases of exception?

It works fine for me. Try the attached example.
exception.zip (5.7 KB)

Cheers

Thanks, could you list your dependencies? Having trouble seeing some activities in your attachment

Here you are
project.json (1.6 KB)

Hmm odd, I’m basically doing the same you did with the dictionary. With regards to REFramework, the try catch is within the Main where it invokes the “Process” XAML. My 3rd level process is then a invoked process in “Process”. I’ve had two separate In/Out argument Dictionaries where one goes into the 3rd level’s dictionary. I would expect it to be returned with the updated values after error occurred in the 3rd process and carried to the 2nd level’s dictionary. Then the 2nd level’s dictionary should pass into the first process “Main” as a variable in the 1st level.

In my case, 3rd level passes the updated values fine into the 2nd level. However the dictionary isn’t passed back out to the variable in the 1st level. The first level passing in is working since I wouldn’t be able to process further onto from 2 to 3 however it’s not updating the values from the 2nd level to the first.

Do I need any of your specific dependencies in order for this to work? I created my dictionary through a initialization (new dictionary) assign instead of a default value for the variable.

Sorry double posting, I solved my problem. I was initializing the subsequent arguments again within the sub processes. If you do that you won’t be able to pass them properly (I had an assign to new dictionary in my 2nd level).

Now I used a multi-assign to update the values of the dictionary’s key values instead of initializing the dictionary again. Not sure why this is the case, but I’m lacking in that programming knowledge. Thanks though!

:+1: