A calendar object often carries text a third party chose: an attendee's name, a meeting title, an invitation that
arrived by email. DevOp.ICalendar is strict on the way out, so such text cannot change the structure of what you
send, and bounded on the way in, so such a document cannot exhaust your process.
Every logical line passes through ContentLine.AppendFolded before it is written, and that refuses CR, LF and every
other control character except HTAB with ArgumentException. This covers modelled values, addresses, display
names, PRODID, TZID, typed extra properties, and the lines of UnknownProperties and OverrideComponents
(override blocks are unfolded and checked line by line). A value cannot end its line and start another property or
a component.
A typed property (IcalComponent.Properties) must have an RFC 5545 token as its name (A-Z, a-z, 0-9, -),
and cannot be BEGIN or END (which would open or close a component), METHOD (a calendar-level property a
reader could take for the message's method), or any property the model writes, such as UID, DUE or COMMENT.
The full list is on the model page; a test keeps it equal to the names the writer emits.
SUMMARY, DESCRIPTION, LOCATION, COMMENT, UID, CATEGORIES, alarm text, typed TEXT\, ;, , and newline (RFC 5545 §3.3.11).URL, CONFERENCE, typed URI properties such as IMAGE) are written verbatim, as RFC 5545 requires,CN, LABEL, every IcalParameter) use RFC 6868 (^ as ^^, newline as ^n, " as ^'):, ; or , (or start or end with whitespace), so a display nameLines are folded so no physical line exceeds 75 octets, the continuation space included. A fold never splits a
UTF-8 sequence or a surrogate pair, and falls between grapheme clusters, so emoji, flags and accented letters
reach the receiver intact; a cluster longer than a line is split between its code points.
IcalCodec.Parse(text) has no bound. For a document you did not write, use
IcalCodec.Parse(text, IcalParseLimits.Default) or the DI codec, whose
Parse applies the configured limits:
| Limit | Default | Counts |
|---|---|---|
MaxInputLength |
1,048,576 | UTF-16 characters in the document, folding included. |
MaxComponents |
1,000 | BEGIN lines, the VCALENDAR and nested components included. |
MaxPropertiesPerComponent |
1,000 | Content lines inside one VEVENT, VTODO or VJOURNAL, nested lines included. |
MaxLineLength |
65,536 | UTF-16 characters in one content line after unfolding. |
MaxNestingDepth |
8 | Component depth, the VCALENDAR counting as 1. |
MaxTzidLength |
256 | UTF-16 characters in a TZID parameter, on any content line. |
A document past any limit is refused with IcalParseLimitExceededException, a FormatException whose Limit
names the limit and Maximum gives its value. The line limit is checked while unfolding, before the line is
built, and unfolding takes linear time however many continuation lines a property has. Each distinct TZID is
resolved once per parse, and a vendor-prefixed one looks up only trailing segments short enough to be a zone id.
A TZID-qualified date-time that converts outside the range of a DateTimeOffset is a FormatException too. Every
limit must be positive; IcalParseLimits.Unlimited disables them.
ImipEnvelope.ForInbound (when the part has no method= parameter) and IcalCodec.ReadMethod unfold the whole
document with no limit; check the part's size before calling them. The DI codec's ReadMethod applies the input
and line length limits first.
It does not decide who may send a REQUEST, whether a REPLY comes from the attendee it names, or whether a
sender may change an event: verify the sender and apply scheduling rules in your application. A CONFERENCE with
the Moderator feature gives whoever receives it moderator rights; do not send such a link to attendees.