Inside the method MoveBall
, you have the SetCursorPosition arguments inverted.
The first one is the distance from the left border and the second one the distance from the top border.
Console.SetCursorPosition(Console.WindowWidth / 2, Console.WindowHeight / 2);
This causes the error because the max value for the y value is 24 and you pass 40.