A motion in arrest of judgment shall be in writing, shall state the ground upon which it is based, and shall be tried contradictorily with the district attorney.