Pick Hanging with Invoke Code

I’m having an issue. My invoke code hangs on line 3, so I would expect the WriteLine(“test”) in the second branch to execute and complete, however it never does.
The intention was to have a 30 second delay in the second Pick Branch, but the WriteLine is just for testing purposes. Can anyone help please?

Dim app As Microsoft.Office.Interop.Word.Application = New Microsoft.Office.Interop.Word.Application
Dim doc As Microsoft.Office.Interop.Word.Document = app.Documents.Open(filepath.ToString)
Dim doctxt As String = doc.Content.Text
content = doctxt

It doesn’t “hang”, the branch with “Invoke Code” is cancelled because the trigger of the other branch completes first.

Read more here:


Sorry, I wasn’t clear. I’ve edited the post to clarify.

The trigger in the other branch isn’t completing. If it completed “test” would be written to the console.

All that happens is “***1” is written to the console, and then nothing happens.

The issue is a word document with a macro preventing it loading properly, but I don’t understand why it hangs and prevents the other pick branch with the writeline from completing.


1/ I do not know your use case,if it is some real scenario or just an experiment.
But in any case I would recommend you follow best practices described in the article.

2/ I would propose to verify you Invoke Code standalone first.


1/ The above is an cut down extract from a real scenario which is iterating through 1000s of .doc* files reading the text from them. The purpose of the Pick was to provide a timeout for if the invoke code fails to complete successfully.

2/ The invoke code works. The issue is the Pick is not working as expected. I.E if there left branch doesn’t complete (which it doesn’t as it hangs on line 3 when opening a specific document), then the right branch should (as it’s just a write line - although in reality it would be a 30 second delay activity with a throw SystemException).

And have you tried the real scenario with 30sec delay?


1 Like

Yes, same issue with the 30 second delay activity. After the left branch hangs on line 3 neither Pick branch completes… even after 30s

You could try Parallel activity instead.
I use following approach when I need real parallel execution:


1 Like

Just logging off for a long weekend, but I’ll give that a go when back in work next week. Many thanks for taking the time to help.

Hi @andrewjames,
I have exactly the same issue with the same scenario. Did you find a solution or a workaround?


I’m afraid I can’t remember