Uninformative error message

studio
i_considering
variable

#1

At runtime a variable may not be initialized, contrary to expectations. However the error message Exception Type: NullReferenceException does not indicate which variable is throwing the exception. This is quite annoying in larger projects. So, can we have the name of the uninitialized variable inside the error message? I know uipath indicates which block failed, but they can have multiple variables.

Example: a web scraping workflow is expected to return a datatable, but the procedure returns an empty datatable. Later another invoked workflow tries to save the datatable to an xlsx file, which fails. Now I get to guess which variable the error message is referring to.

Main has thrown an exception

Source: Invoke workflow file: Append Range

Message: Object reference not set to an instance of an object. This error usually occurs when using a variable with no set value (not initialized).

Exception Type: NullReferenceException

System.NullReferenceException: Object reference not set to an instance of an object.
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)


#2

Have you checked inside the logs if there is additional information / the variable name?


#3

Whether the file name is there or not, it still means extra time spent navigating folders and files. My point is to present the variable name front and center when such a NullReferenceException occurs.


#4

Actually yes, i agree with. I misunderstood the request initially.


#5

Hi , please can you explian this littele bit clearly, I am also getting the same issue, but i didnt understand the solution you have provided, my variable name is ‘Extractdatatable’, please can you heklp me on this. I used in Excel append range activity.

Duns_Extract_v1 has thrown an exception

Source: Append Range

Message: Object reference not set to an instance of an object. This error usually occurs when using a variable with no set value (not initialized).

Exception Type: NullReferenceException

System.NullReferenceException: Object reference not set to an instance of an object.
at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)


#6

You can, however, identify the activity that throw the error (no matter if you’re using exception handling or not).

I would say that it’s the same when coding…it’s not a variable throwing the error but an instruction located at a code line.