Buggy behaviour with Queue<T>.Dequeue() function in Studio debugger

In a UiPath project, I have encountered a very strange issue: One activity seems as if it’s executed twice each time the robot is manually stepped through it while debugging in Studio.

My Studio version is 2021.10.5.

I have two variables,

  • TransactionQueue (Queue<Object>)
  • TransactionItem (Object)

At one point, the queue contains three objects inside of it:

The robot is executing the Assign activity where the first object is supposed to be extracted from the queue using Dequeue() function and assigned to TransactionItem variable:

Just prior to executing the activity, debugger correctly shows what should happen once the activity executes:

And yet, the result of executing the activity is that TransactionItem has been assigned the value 3, and two items have been removed from the TransactionQueue, as if Dequeue() had been called twice:

This only happens when I step into/over the Assign activity using the debugger, not when the robot is allowed to freely run on its own through the activity.

This sure seems like a debugger-related bug to me.


We are noticing the exact same behavior as well. Definitively a debugger issue. Would be great if this could be fixed.

I wish I had seen this post before spending over an hour trying to solve this same issue. I even tried this with ConcurrentQueue<T> and got the same bug occurring in Debug mode.

This really should be fixed whenever possible, especially because UiPath recommends Queue<T> for designing transaction-based processes without Orchestrator:

Edit: tried with several other collections (Stack/ConcurrentStack, BlockingCollection, and ConcurrentBag) and all of them have this same issue.