Where motion proceedings have been instituted and material disputes of fact arise that cannot be resolved on affidavit, the court has a wide discretion under Rule 6(5)(g) to refer the matter to trial with appropriate directions. The test for whether disputes were foreseeable is objective - whether the applicant ought reasonably to have foreseen that material disputes would arise. An applicant who brings an 'omnibus challenge' against multiple respondents operating in divergent locations with differentiating operations ought reasonably to foresee factual disputes. However, where the matter involves serious environmental impacts and public health risks that are in the public interest, a court may properly exercise its discretion to refer the matter to trial rather than dismiss it, while penalizing the applicant through an appropriate costs order for the inappropriate use of motion proceedings. The costs order should reflect: (1) payment by applicants of costs on an unopposed basis for the abortive application proceedings; and (2) reservation of remaining costs including expert fees for determination by the trial court, as those issues may yet prove relevant at trial.