Added delay, got runtime exception, but I wasn't watching so idk what failed

I added a delay to try to make Element Exists work, and then all of a sudden I get a runtime exception. The last time I was getting runtime exceptions, I was also working with a delay.

Is delay broken? Is it not supported, experimental, or something like that?

These runtime exceptions don’t tell me what activity killed them, so I’m left interpolating where the robot stopped, which isn’t ideal.

19.10.4+Branch.support-v2019.10.Sha.fe819a658cad0585a64d2f8af94fad5c30b8d122

Message: Type 'System.Collections.IEnumerable' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.  If the type is a collection, consider marking it with the CollectionDataContractAttribute.  See the Microsoft .NET Framework documentation for other supported types.

Exception Type: System.Runtime.Serialization.InvalidDataContractException

RemoteException wrapping System.Runtime.Serialization.InvalidDataContractException: Type 'System.Collections.IEnumerable' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.  If the type is a collection, consider marking it with the CollectionDataContractAttribute.  See the Microsoft .NET Framework documentation for other supported types. 
   at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.Activities.WorkflowApplication.IdleEventHandler.OnStage2Complete(IAsyncResult lastResult, WorkflowApplication instance, Boolean isStillSync)
   at System.Activities.WorkflowApplication.EventFrame(IAsyncResult result)

Please tell us what was the activity you were working with, so we can help you better.

I added a delay for 1 second, I got the runtime exception. I removed the delay, I don’t have the runtime exception.

still the error itself will have more to do with an actual activity, maybe in combination with the delay…

That’s what I would expect to see given how errors are normally presented when debugging UIPath code.

However, this crashes the debugger, so there’s no way for UIPath to point to an activity while in debug mode.

Use try catch activity. Inside catch block use log message and print exception.source & exception.message.
This will give you the clear idea of where the error occurred. :slightly_smiling_face:

It turns out it’s just the delay crashing it. Since it’s a non-expandable activity, does that mean it’s supposed to go in another activity?