Select an object path and open the Stroke panel. Select one of the new Dashed line boxes. The one on the left maintains the dash length and gap you specify. Click the one on the right to see the dashes align to an object’s corners and path ends, adjusting dash length and spacing to fit.
Learn how to make smarter dashes in Illustrator