When it becomes impossible to carry out any last will and testament in whole or in part, and in all matters of contract, the judges of the superior courts shall have power to render any decree that may be necessary and legal, provided that all parties in interest shall consent thereto in writing and there shall be no issue as to the facts or, if there is such an issue, that there shall be a like consent in writing that the judge presiding may hear and determine such facts, subject to a review on appeal, as in other cases. In all cases where minors are interested, the consent of the guardian at law or the guardian ad litem shall be obtained before the decree is rendered.