public override object Execute(CommandContext commandContext) { ExecutionEntity execution = commandContext.ExecutionManager.FindExecutionById(executionId); // fetch the variable instance but not the value (make sure the byte array is lazily fetched) VariableInstanceEntity varInstance = (VariableInstanceEntity)execution.GetVariableInstanceLocal(varName); string byteArrayValueId = varInstance.ByteArrayId; Assert.NotNull("Byte array id is expected to be not null", byteArrayValueId); var cachedByteArray = commandContext.ByteArrayManager.Get(byteArrayValueId); Assert.IsNull(cachedByteArray, "Byte array is expected to be not fetched yet / lazily fetched."); Monitor.Sync(); // now update the value execution.SetVariableLocal(varInstance.Name, newValue); return(null); }