-
Notifications
You must be signed in to change notification settings - Fork 248
Description
FrequencyType.None
The FrequencyType.None value should be removed because it is neither meaningful in the context of frequency enumeration nor does it have a valid string representation. Its presence could lead to confusion when users create a RecurrencePattern.
In turn RecurrencePattern.Frequency should either become nullable or - for simplicity - have a default value (e.g. FrequencyType.Yearly.
The only test for a valid FrequencyType is necessary in RecurrencePatternSerializer where an invalid input string should throw.
Check for valid RecurrencePattern.Frequency in Evaluator
Currently we have a check for a valid FrequencyType, that originates in the existence of FrequencyType.None.
ical.net/Ical.Net/Evaluation/Evaluator.cs
Lines 46 to 48 in ca0e6e4
| // FIXME: use a more specific exception. | |
| default: | |
| throw new Exception("FrequencyType.NONE cannot be evaluated. Please specify a FrequencyType before evaluating the recurrence."); |
However, Frequency should always be valid at this stage.
The default case should just trigger a Debug.Fail as a safeguard indicating a missing implementation.
There is no need to throw an Exception for users.
Originally posted by @axunonb in #785 (comment)