I encountered a problem with C# code execution, namely, when executing an asynchronous method, the execution of the entire project is suspended on Invoke Code and is not executed further.
In the search engine I found a similar problem with the user: How to invoke async activity in UIPath - Stack Overflow
His problem is exactly the same as mine.
No one has ever encountered such a thing?
I use a third-party nuget package from the repository. It is a class library. I use them to access the service’s API. The code contains specific syntax that may not be clear because it uses the service’s API keywords. But I assure you, any call to an asynchronous method via Invoke Code will cause a “stop” in the project.
But maybe I’m wrong, and it’s also about the HTTP request… Since my code contains an HTTP request, and I can’t debug it, or at least call MessageBox at certain stages of code execution…
Find errors. Any interaction of this type with the code causes the process to hang. More precisely, invoke code runs indefinitely and does not terminate.
I’m talking about the type: System.Threading.Tasks.Task<>
I would like to know what exactly is causing the problem and how to solve it… Since the error forces you to look for workarounds that are much more difficult to implement! But, apparently, it is not my fate to hear any comments from developers on this issue… Anyway, thank you all for your attention.
Would this help you here?
I am also facing the same issue with “async System.Threading.Tasks.Task” in invoke code. I have a for each and then an invoke code inside of it. However, when the first iteration is suspended, the second iteration immediately starts and I need synchronously. I used this library because I am implementing a code with ExchangeWebService (EWS) with OAuth2.
Did you find a solution to implement this kind of method?
I think you can potentially do this with the new Coded Workflows feature (starting from Studio 2023.10).
Please have a look at this sample project that I got while testing things with SOAP requests and which uses an async task:
Generating code with Coded Workflows to send SOAP requests