Error null reference


Source: Assign

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

Exception Type: System.NullReferenceException

RemoteException wrapping System.NullReferenceException: Object reference not set to an instance of an object.
at System.Activities.ExpressionUtilities.ArrayLocationFactory1.ArrayLocation.set_Value(T value) at System.Activities.Location1.ReferenceLocation.set_Value(T value)
at System.Activities.Location`1.set_ValueCore(Object value)
at System.Activities.ActivityContext.SetValueCore[T](LocationReference locationReference, T value)
at System.Activities.ActivityContext.SetValue[T](LocationReference locationReference, T value)
at System.Activities.Argument.Set(ActivityContext context, Object value)
at System.Activities.Statements.Assign.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

1 Like

The error is because you are passing the null value on the right side of the assign activity @DEEKSHIT3107

Try giving the value in a message box before assigning it to a variable

1 Like


this error usually occurs when the activity associated with this error has a variable with no value in it
–use a write line activity before the activity where this error occurs and pass that variable as input to write line activity
–this will help us to debug whether the variable has any value in it or not
–in addition if we want to validate before getting to this activity (the one which throws this error) we can use a IF condition and mention like this
Not String.IsNullOrEmpty(yourvariablename)
if true means not null so will go to THEN part where we can use the current activity or it will goto ELSE part where we can leave it simply so that we wont process that value in that variable being so null

hope this wuld help you
Cheers @DEEKSHIT3107


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