If construct is unable to verify/output(via a message box) value of a variable

Hi UIPathians,

  1. Am trying to output a value of a string variable from inside an if construct but get below error after execution, which is otherwise being utilized without any issue by other activities:

Logs generated:

18.3.2+Branch.master.Sha.0ee1a557250c8000e864a91dcaeebdc1a4bbeb00

Source: If

Message: Object reference not set to an instance of an object.

Exception Type: System.NullReferenceException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.NullReferenceException: Object reference not set to an instance of an object.
at lambda_method(Closure , ActivityContext )
at Microsoft.VisualBasic.Activities.VisualBasicValue1.Execute(CodeActivityContext context) at System.Activities.CodeActivity1.InternalExecuteInResolutionContext(CodeActivityContext context)
at System.Activities.Runtime.ActivityExecutor.ExecuteInResolutionContext[T](ActivityInstance parentInstance, Activity1 expressionActivity) at System.Activities.InArgument1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityExecutor executor)
at System.Activities.RuntimeArgument.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor, Object argumentValueOverride, Location resultLocation, Boolean skipFastPath)
at System.Activities.ActivityInstance.InternalTryPopulateArgumentValueOrScheduleExpression(RuntimeArgument argument, Int32 nextArgumentIndex, ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Boolean isDynamicUpdate) at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

  1. Also, the above workflow compares value of dates extracted from two different places.
    I can see that the values are totally same but if construct gives opposite output.

Any help in this regard is highly appreciated.

PS: Let me know if any other input is required from my end.

Thanks!

Hi @Akanksha_Varshney,

what condition did you gave in if condition?

Its is clearly showing the variable is null, there is no value present.

Convert.Tostring(yourvariable)

Regards,
Arivu

Hi @arivu96-
I somehow believed that it should work even without conversion - since both the comparison values are already of String datatype.
Thanks for the solution!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.