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
Console.WriteLine(“***1”)
Dim doc As Microsoft.Office.Interop.Word.Document = app.Documents.Open(filepath.ToString)
Console.WriteLine(“***2”)
Dim doctxt As String = doc.Content.Text
Console.WriteLine(“***3”)
app.Quit()
content = doctxt
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).