OperationCanceledException

While debugging locally an application we are restructuring I am running in to an error that I can’t seem to get past.

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.OperationCanceledException: An error occurred while calling tracking participants causing the instance to be aborted. See the inner exception for more details. ----> System.NullReferenceException: Cannot create an L-value from the given expression with property ‘get_Item’ because the target object is null.
at System.Activities.ExpressionUtilities.IndexerLocationFactory1.IndexerLocation.get_Value() at System.Activities.Location1.get_ValueCore()
at System.Activities.Tracking.ActivityStateRecord.TrackData(String name, Int32 id, ActivityInstance currentInstance, ICollection1 data, Boolean wildcard, Dictionary2& trackedData)
at System.Activities.Tracking.ActivityStateRecord.GetArguments(ICollection`1 arguments)
at System.Activities.Tracking.RuntimeTrackingProfile.ExtractArguments(ActivityStateRecord activityStateRecord, ActivityStateQuery activityStateQuery)
at System.Activities.Tracking.RuntimeTrackingProfile.PrepareRecord(TrackingRecord record, TrackingQuery query, Boolean shouldClone)
at System.Activities.Tracking.RuntimeTrackingProfile.Match(TrackingRecord record, Boolean shouldClone)
at System.Activities.Tracking.TrackingProvider.FlushPendingRecordsAsyncResult.PostTrackingRecord(TrackingParticipant participant, RuntimeTrackingProfile runtimeProfile)
at System.Activities.Tracking.TrackingProvider.FlushPendingRecordsAsyncResult.RunLoop()
at System.Activities.Hosting.WorkflowInstance.BeginFlushTrackingRecords(TimeSpan timeout, AsyncCallback callback, Object state)
at System.Activities.Hosting.WorkflowInstance.OnBeginFlushTrackingRecords(AsyncCallback callback, Object state)
at System.Activities.Runtime.WorkItem.FlushTracking(ActivityExecutor executor)
— End of inner ExceptionDetail stack trace —

This happens when it goes to call an invoke workflow activity. It doesn’t appear to be the workflow itself but a runtime exception. Looking in the Event Viewer I am given some additional information:

System.Activities.WorkflowApplicationAbortedException: The operation could not be performed because WorkflowApplication 52b603b6-467a-4022-83b7-c71a4c59617f is aborted.
at System.Activities.WorkflowApplication.ThrowIfAborted()
at System.Activities.WorkflowApplication.CancelAsyncResult.ValidateState()
at System.Activities.WorkflowApplication.SimpleOperationAsyncResult.Run(TimeSpan timeout)
at System.Activities.WorkflowApplication.BeginCancel(AsyncCallback callback, Object state)
at UiPath.Executor.RobotRunner.Cancel() in D:\a\1\s\Robot\UiPath.Executor\RobotRunner.cs:line 352, HResult -2146233088

So far searching old posts has not shed any light on how to resolve this. If anyone has any information on what might be causing it let me know. I tried an uninstall/reinstall and before that stopping the bot service and rebooting my machine. I am currently using version 2018.4.4.

Hi @code_monkey

I think this bit is crucial:
Cannot create an L-value from the given expression with property ‘get_Item’ because the target object is null.

Please make sure you are correctly passing all arguments into the invoked workflow. It seems some values are not properly initialized (therefore not correctly passed into the inoked workflow).

I believe I determined the issue. I put a side test together where I created a datatable then using the Rows collection with an index of 0 for the first row tried passing that row in to the invoke workflow activity of another xaml simply to see if it would pass. If I had the argument as in/out that error occurred. If I set it to just in, then it did not throw that error. I believe this may have to do with the read only nature of the rows collection coming in conflict with the argument type.