If a browser operation (f.e. attach) is being cancelled, it throws following error:
PickTest has thrown an exception Message: The activity 'Launch Workflow Interactive' with ID 7 threw or propagated an exception while being canceled. Exception Type: InvalidOperationException System.InvalidOperationException: The activity 'Launch Workflow Interactive' with ID 7 threw or propagated an exception while being canceled. ---> System.InvalidOperationException: The activity 'Attach Browser 'iexplore.exe Google'' with ID 3 threw or propagated an exception while being canceled. ---> UiPath.Core.BrowserOperationException: Operation was canceled. ---> System.Runtime.InteropServices.COMException: Operation was canceled. at UiPath.UiBrowserClass.Find(String bstrSelector) at UiPath.Core.Browser.Find(Selector selector) --- End of inner exception stack trace --- at UiPath.Core.Activities.ScopeActivity.EndExecute(NativeActivityContext context, IAsyncResult result) at UiPath.Core.Activities.AsyncNativeActivity.BookmarkResumptionCallback(NativeActivityContext context, Bookmark bookmark, Object value) at System.Activities.Runtime.BookmarkCallbackWrapper.Invoke(NativeActivityContext context, Bookmark bookmark, Object value) at System.Activities.Runtime.BookmarkWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager) --- End of inner exception stack trace --- at UiPath.Core.Activities.InvokeWorkflowFile.EndExecute(AsyncCodeActivityContext context, IAsyncResult result) at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result) at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager) --- End of inner exception stack trace ---
This is not consistent with AttachWindow, TypeInto or other activities that can be cancelled normally.
Edit: Since an error thrown during cancellation is equivalent to throwing from Catch block or using TerminateWorkflow it bypasses immediate level TryCatch making it very awkward to design around.
i have tried to reproduce the problem, but i`m having trouble canceling the workflow right after run. the attach activity happens instantly and there is no time to stop it from studio
how do you reproduce this, can you give us more details?
Please find attached a repro example - itās a parallel setup with a failing Attach in one branch and delay (essentially a timeout equivalent) in the second branch.
Hi Guys, do you know how fix handle that error? I have one similar and I don`t know how to handle ā¦
System.InvalidOperationException: The activity āWaitImageAppearā with ID 36 threw or propagated an exception while being canceled. ā> UiPath.Core.Activities.ActivityTimeoutException: Activity timeout exceeded
at UiPath.Core.Activities.WaitImageAppear.EndExecute(NativeActivityContext context, IAsyncResult result)
at UiPath.Core.Activities.AsyncNativeActivity`1.BookmarkResumptionCallback(NativeActivityContext context, Bookmark bookmark, Object value)
at System.Activities.Runtime.BookmarkCallbackWrapper.Invoke(NativeActivityContext context, Bookmark bookmark, Object value)
at System.Activities.Runtime.BookmarkWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
ā End of inner exception stack trace ā
at UiPath.Core.Activities.InvokeWorkflowFile.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
Yes Iām working in the last one. But I was reading how to handle exceptions and I found that is better using invoke workflow file and sorrounded by a try catch and I did and works ok.
I received also āthrew or propagated an exception while being canceledā kind of error message and problem was that it was not caught by Try-catch in same workflow. Try-catch at higher level workflow caught it.
What is causing this kind of problem and how to catch those exceptions?
I think the problem is related with activities that contain non Thread Safe variables, because this is usually happening while using Parallel or Pick activities and trying to cancel the branch that contains any UiPath activity but especially Ui interacting ones.
@2aozturk Youāre right! I encountered this error when I used a Parallel activity and set the Isolated property on invoked workflows within the parallel activity.
Actually it depends on what perspective youāre looking.
If anyone wants to use parallel threads then she/he needs to make sure using thread safe variables/objects in each thread otherwise accessing the same object at same time by different threads will cause failures in any of the threads. I think this is exactly what is happening in this case. Cancelling thread canāt be cancelled because cancelling activity is trying to do something with non-thread-safe variable/object. Usually in this case the only affected thread should be the failed one and all the other threads should be working fine but because of the nature of Parallel/Pick activity any failed thread will cause the Parallel/Pick activity itself to fail. Unfortunately this is not something we can manage completely with try-catches or any other methods because the exception is being raised in a place that we canāt catch. UiPath needs to help us by reviewing itās UI interacting activities in thread safety perspective. Until then, Iām afraid we need to give up using parallely working activities instead need to make our checks sequentially to make it sure it will work completely without these kinds of errors. I know this is causing a performance issue but this is the only thing we have. I also mainly see this problem with UI interacting activities.
Hi @loginerror. When you have a moment could you please review @2aozturkās insightful response to the issue of uncatchable exceptions caused when using cancelling a non-thread safe activity in a Parallel activity thread in UiPath? Weāre experiencing the same issue with cancellation of Attach Browser activities that are running in parallel. Interestingly, I donāt have any issue with Find or Attach Window activities when running in parallel, so Iām guessing something about the Attach Browser activity makes it non-thread safe, to @2aozturkās point. Iām more than happy to log a ticket with Support to review, if you think that would be of benefit.
Would you mind creating a sample project that reproduces this issue with a public website and then submit that project, as well as all the contextual info (like a link to this topic) via the Studio feedback feature?
Then either me or @Pablito will process it further and it will be reviewed by our engineers
Many thanks for your time in review. Iāve attached a sample project as requested that demonstrates how a cancellable Parallel activity (Condition argument set to True) with Attach Browser(s) within one or more threads results in an uncatchable exception. Iāve included a Try-Catch to demonstrate how the exception generated isnāt caught by the catch and instead results in the entire workflow throwing an exception related to the uncancellable activity.
Here is the sequence xaml by itself: project.json (1004 Bytes)
Let me know if thereās any other support I can provide. Iām happy to log a ticket with Support if needed. Iāve started converting many of our librariesā Parallel activity threads to use Attach Window or simply Find rather than Attach Browser as they both appear to be cancellable without issue. This approach works well, except that Attach Browser tends to work best when attaching using a URL root. It would be great if we could have clarity on what activities are considered non-cancellable - if UiPath Studio natively understood those activities, perhaps it could notify the developer in UiPath Studio that a non-cancellable activity was included in a cancellable Parallel activity (only when the Parallel activityās Condition is set to True).
UiPath recommends the use of parallel activities to timebox UI activities when interacting with SAP. Unfortunately we are getting the same cancellation error described in this forum, but without using parallel activities we occasionally experience the freezing error that can only be negated by the use of a parallel timebox. Would be good to have this bug rectified soon.
The issue is currently being internally tracked, but I cannot offer any specific timeline.
One suggestion I would make is that if you are an Enterprise customer, you could try contacting our technical support to have some direct assistance around your specific use-case. You could use this form:
Try to use invoke workflow activities in parallel branches by setting Isolated property as checked.
This may sometimes (depending on the actions you try to make) help Parallel activity not to fail even any of the branches fails but unfortunately passing complex arguments to these Isolated Invoke Workflow activities is not as easy as you can do it in usual way, please try to use simple arguments.
Bu again, I would suggest not to use UI interacting activities in Parallel/Pick branches or State Machine Transitions.
we have just updated to the newest version of UiPath after being behind for a year.
Suddenly a pickBranch acitivity in one of my processes started making this error. Before the update it worked fine.
While we wait for a solution, i have made this simple workaround for anyone having issues: Pick_Sequencial.xaml (9.9 KB)
It takes an array of selectors that it looks for (element exists, timeout 1000) one at a time, retrying a number of times until it finds one or reaches the max number of tries.
After running this, you can make a switch activity, that then acts as the ābranchā part of pickBranch