throw invalidoperationexception c#