Attempt to make SetDirectory serializable, even if the Factory is not itself.