How can I eliminate 'Invoke Code' Startup Delay?

On the first Invoke Code activity (CSharp) (even if it is empty), there is a distinct startup delay for this activity. You can easily see it when Execution Trail is enabled during a debug.

How can I prevent this inherent delay from occurring?

Hi @grosner
I recently noticed the same thing for invoke code activity.
I couldn’t find any solution to be honest, other than developing a custom activity in C# for that purpose.

Can you either share the custom activity or explain how this helped?

The custom activity contained the C# code i was putting inside the invoke code activity.
A custom activity is an activity that is developed from scratch in visual studio (in c# or vb.net)
The difference is basically that compiled code is always faster than interpreted code even if it’s the same programming language.
Hope this helps :slight_smile:

ok. Thank you. What is most interesting is that even an empty Invoke Code activity causes a delay, but the very next Invoke Code is NOT delayed!
So I am guessing this is caused by UiPath doing some kind of later binding to call in the CSharp imports when it encounters the very first invoke code.

1 Like