Question / Problem:
Why does a file not get written with a Write File step in Design Studio.
This is seen when a delete is done before the write in order to insure the file doesn't already exist. And is only manifested when stepping through a robot a single step at a time.
Answer / Solution:
This is a consequence of the way Direct execution works. All steps are re-executed every time you go to the next step, but steps that succeed will not really be re-executed, but a cached output state is used. In a robot if the file doesn't already exist the Delete File fails, so its output state is not cached. Then you hit the Write File step and the Delete is re-executed first which does nothing and the file is written successfully. When you hit another step the Delete is done again because it has failed and it's state is not cached. However the Write is not executed because it worked and the step is not executed because the state was cached. Thus the file disappears. If you execute the robot to the end without stepping through there is nothing to re-execute because you are not going one step at a time.
You can write the robot in a slightly different way that will solve the problem. Put a try step be fore the Delete File step, change error handling on the Delete File step to "Try Next Alternative", add a second edge to the try step that leads around the Delete File step.