If any action is brought in circumstances in which this Part of this Act provides that no action is to lie, a judge of the court in which the action is brought may, on the application of the defendant and upon an affidavit as to the facts, set aside the proceedings in the action, with or without costs, as the judge thinks fit.