Are you sure you are actually getting mastership correctly by stepping through the code to make sure that mc and mr are not null? What is the actual exception type that you are getting? You must be logged on to the controller with a user that has the UAS_RESTORE grant and the controller must be in auto mode in order to restore.
I’m not using the example completely as described above, because i’ve implemented it in my own code. I have all masterships and I have all UAS rights on the controller and I’m in automode.
I’m giving in as described in above example the restoreDir path and I already have then the masterships. The Restore just fails with the exception “Argument Exception”, message: “value does not fall within the expected value”. I wan’t to know what’s wrong with my path or what the exception means with not in range, because backup function works fine with it.