Error on running 2 dependent jobs - Object reference not set to an instance of an object

Hello. I am experimenting with Orchestrator Scheduler and Jobs and so on and I currently have this situation:

Process A: Creates a text file on a certain folder
Process B: Moves that text file to another folder
Main Process: Has Start Job (A) and then Start Job (B)

When I run Main Process on Orchestrator it runs Process A smoothly and then when it goes on to Process B it starts running but then fails with this details:

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

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Activities.Statements.Throw.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)

Does anyone know what is going on?

1 Like

Hi @martalopes

It might be that any of your argument is passing null or add some delay after Process A (possible that it couldn’t create complete file while the bot is trying to access it!!) so that when Process B starts it could have a complete text file.

1 Like

But doesn’t Orchestrator wait for a process to finish before starting the next one? Why is delay needed?

Yes exactly, orchestrator doesn’t wait. When you are trying to run process B without completion of process A i.e., bot runs at a faster rate, so while creating a text file in a folder there is a chance that by the time it creates, the process would be complete and process B execution will start. Possible that it could fail because the processes are dependent.

And is there any way to make sure that the robot waits until Process A is completed before starting to run Process B? I really thought that if a process was running the next one would be pending and waiting until the first process is completed.

Are you running on individual bots ? If only one bot, obviously when 2 jobs are started one will be in pending state and the other will be running.

Yes, I am only using an individual bot! In that case maybe I am passing an argument null right? Since the delay would not make sense to add.

yeah!! So run process A first and followed by process B. But you can add a delay in the process B code. Check manually upon completion of process A whether it created file successfully or not and then run process B. Run the jobs one by one (don’t trigger both processes at a time) and see whether the same error is coming or not!!

1 Like

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