[GH-ISSUE #386] Null reference exception at DDay.iCal.iCalTimeZoneInfo #371

Closed
opened 2026-02-25 20:31:30 +03:00 by kerem · 2 comments
Owner

Originally created by @JGKle on GitHub (Apr 3, 2023).
Original GitHub issue: https://github.com/aluxnimm/outlookcaldavsynchronizer/issues/386

Using 4.4.0, for every sync, I'm getting the following exception:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at DDay.iCal.iCalTimeZoneInfo.<>c__DisplayClass2.<GetObservance>b__0(IPeriod p)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at DDay.iCal.iCalTimeZoneInfo.GetObservance(IDateTime dt)
   at DDay.iCal.iCalTimeZone.GetTimeZoneObservance(IDateTime dt)
   at DDay.iCal.iCalDateTime.GetTimeZoneObservance()
   at DDay.iCal.iCalDateTime.get_UTC()
   at DDay.iCal.iCalDateTime.op_Subtraction(iCalDateTime left, IDateTime right)
   at DDay.iCal.Event.ExtrapolateTimes()
   at DDay.iCal.CalendarObject.DeserializedInternal(StreamingContext context)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at DDay.iCal.SerializationUtil.OnDeserialized(Object obj)
   at DDay.iCal.iCalParser.component(ISerializationContext ctx, ISerializerFactory sf, ICalendarComponentFactory cf, ICalendarObject o)
   at DDay.iCal.iCalParser.icalbody(ISerializationContext ctx, IICalendar iCal)
   at DDay.iCal.iCalParser.icalendar(ISerializationContext ctx)
   at DDay.iCal.Serialization.iCalendar.iCalendarSerializer.Deserialize(TextReader tr)
   at CalDavSynchronizer.Implementation.CalDavRepository`1.DeserializeCalendar(String iCalData, IStringSerializer calendarSerializer)
   at CalDavSynchronizer.Implementation.CalDavRepository`1.TryDeserializeCalendar(String iCalData, IICalendar& calendar, WebResourceName uriOfCalendarForLogging, IStringSerializer calendarSerializer, ILoadEntityLogger logger)

Here's the ics:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ddaysoftware.com//NONSGML DDay.iCal 1.0//EN
BEGIN:VTIMEZONE
TZID:Turks And Caicos Standard Time
BEGIN:STANDARD
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;UNTIL=20150101T050000Z;BYDAY=1SU;BYHOUR=2;BYMINUTE=0;BYMO
 NTH=11
TZNAME:Turks and Caicos Standard Time
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
BEGIN:STANDARD
DTSTART:20150101T000000
RRULE:FREQ=YEARLY;UNTIL=20160101T050000Z;BYDAY=1TH;BYHOUR=0;BYMINUTE=0;BYMO
 NTH=1
TZNAME:Turks and Caicos Standard Time
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
BEGIN:STANDARD
DTSTART:20160102T000000
RRULE:FREQ=YEARLY;UNTIL=20170101T050000Z;BYHOUR=0;BYMINUTE=0;BYMONTH=1;BYMO
 NTHDAY=1
TZNAME:Turks and Caicos Standard Time
TZOFFSETFROM:-0500
TZOFFSETTO:-0500
END:STANDARD
BEGIN:STANDARD
DTSTART:20170102T000000
RRULE:FREQ=YEARLY;UNTIL=20180101T050000Z;BYHOUR=0;BYMINUTE=0;BYMONTH=1;BYMO
 NTHDAY=1
TZNAME:Turks and Caicos Standard Time
TZOFFSETFROM:-0500
TZOFFSETTO:-0500
END:STANDARD
BEGIN:STANDARD
DTSTART:20181104T020000
RRULE:FREQ=YEARLY;UNTIL=20190101T050000Z;BYDAY=1SU;BYHOUR=2;BYMINUTE=0;BYMO
 NTH=11
TZNAME:Turks and Caicos Standard Time
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
BEGIN:STANDARD
DTSTART:20191103T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYHOUR=2;BYMINUTE=0;BYMONTH=11
TZNAME:Turks and Caicos Standard Time
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;UNTIL=20150101T050000Z;BYDAY=2SU;BYHOUR=2;BYMINUTE=0;BYMO
 NTH=3
TZNAME:Turks and Caicos Daylight Time
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:DAYLIGHT
DTSTART:20150308T020000
RRULE:FREQ=YEARLY;UNTIL=20160101T050000Z;BYDAY=2SU;BYHOUR=2;BYMINUTE=0;BYMO
 NTH=3
TZNAME:Turks and Caicos Daylight Time
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:DAYLIGHT
DTSTART:20160101T000000
RRULE:FREQ=YEARLY;UNTIL=20170101T050000Z;BYHOUR=0;BYMINUTE=0;BYMONTH=1;BYMO
 NTHDAY=1
TZNAME:Turks and Caicos Daylight Time
TZOFFSETFROM:-0500
TZOFFSETTO:-0500
END:DAYLIGHT
BEGIN:DAYLIGHT
DTSTART:20170101T000000
RRULE:FREQ=YEARLY;UNTIL=20180101T050000Z;BYHOUR=0;BYMINUTE=0;BYMONTH=1;BYMO
 NTHDAY=1
TZNAME:Turks and Caicos Daylight Time
TZOFFSETFROM:-0500
TZOFFSETTO:-0500
END:DAYLIGHT
BEGIN:DAYLIGHT
DTSTART:20180311T020000
RRULE:FREQ=YEARLY;UNTIL=20190101T050000Z;BYDAY=2SU;BYHOUR=2;BYMINUTE=0;BYMO
 NTH=3
TZNAME:Turks and Caicos Daylight Time
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:DAYLIGHT
DTSTART:20190310T020000
RRULE:FREQ=YEARLY;BYDAY=2SU;BYHOUR=2;BYMINUTE=0;BYMONTH=3
TZNAME:Turks and Caicos Daylight Time
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
UID:040000008200E00074C5B7101A82E00800000000200C6FB26A58D901000000000000000
 0100000009DA701809DD45B4284BAD692CD904C78
DTSTART;TZID=Turks And Caicos Standard Time:20230406T010000
DTEND;TZID=Turks And Caicos Standard Time:20230406T013000
CLASS:PUBLIC
DESCRIPTION: 
DTSTAMP:20230317T045217Z
PRIORITY:5
SEQUENCE:0
SUMMARY:2023/04/06 - Make Sure I Get Sunscreen
TRANSP:OPAQUE
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:This is an event reminder
TRIGGER:-PT15M
END:VALARM
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
END:VEVENT
END:VCALENDAR

Looks like this one, from back in 2016: https://github.com/aluxnimm/outlookcaldavsynchronizer/issues/107

Originally created by @JGKle on GitHub (Apr 3, 2023). Original GitHub issue: https://github.com/aluxnimm/outlookcaldavsynchronizer/issues/386 Using 4.4.0, for every sync, I'm getting the following exception: ``` System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DDay.iCal.iCalTimeZoneInfo.<>c__DisplayClass2.<GetObservance>b__0(IPeriod p) at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) at DDay.iCal.iCalTimeZoneInfo.GetObservance(IDateTime dt) at DDay.iCal.iCalTimeZone.GetTimeZoneObservance(IDateTime dt) at DDay.iCal.iCalDateTime.GetTimeZoneObservance() at DDay.iCal.iCalDateTime.get_UTC() at DDay.iCal.iCalDateTime.op_Subtraction(iCalDateTime left, IDateTime right) at DDay.iCal.Event.ExtrapolateTimes() at DDay.iCal.CalendarObject.DeserializedInternal(StreamingContext context) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at DDay.iCal.SerializationUtil.OnDeserialized(Object obj) at DDay.iCal.iCalParser.component(ISerializationContext ctx, ISerializerFactory sf, ICalendarComponentFactory cf, ICalendarObject o) at DDay.iCal.iCalParser.icalbody(ISerializationContext ctx, IICalendar iCal) at DDay.iCal.iCalParser.icalendar(ISerializationContext ctx) at DDay.iCal.Serialization.iCalendar.iCalendarSerializer.Deserialize(TextReader tr) at CalDavSynchronizer.Implementation.CalDavRepository`1.DeserializeCalendar(String iCalData, IStringSerializer calendarSerializer) at CalDavSynchronizer.Implementation.CalDavRepository`1.TryDeserializeCalendar(String iCalData, IICalendar& calendar, WebResourceName uriOfCalendarForLogging, IStringSerializer calendarSerializer, ILoadEntityLogger logger) ``` Here's the ics: ``` BEGIN:VCALENDAR VERSION:2.0 PRODID:-//ddaysoftware.com//NONSGML DDay.iCal 1.0//EN BEGIN:VTIMEZONE TZID:Turks And Caicos Standard Time BEGIN:STANDARD DTSTART:19701101T020000 RRULE:FREQ=YEARLY;UNTIL=20150101T050000Z;BYDAY=1SU;BYHOUR=2;BYMINUTE=0;BYMO NTH=11 TZNAME:Turks and Caicos Standard Time TZOFFSETFROM:-0400 TZOFFSETTO:-0500 END:STANDARD BEGIN:STANDARD DTSTART:20150101T000000 RRULE:FREQ=YEARLY;UNTIL=20160101T050000Z;BYDAY=1TH;BYHOUR=0;BYMINUTE=0;BYMO NTH=1 TZNAME:Turks and Caicos Standard Time TZOFFSETFROM:-0400 TZOFFSETTO:-0500 END:STANDARD BEGIN:STANDARD DTSTART:20160102T000000 RRULE:FREQ=YEARLY;UNTIL=20170101T050000Z;BYHOUR=0;BYMINUTE=0;BYMONTH=1;BYMO NTHDAY=1 TZNAME:Turks and Caicos Standard Time TZOFFSETFROM:-0500 TZOFFSETTO:-0500 END:STANDARD BEGIN:STANDARD DTSTART:20170102T000000 RRULE:FREQ=YEARLY;UNTIL=20180101T050000Z;BYHOUR=0;BYMINUTE=0;BYMONTH=1;BYMO NTHDAY=1 TZNAME:Turks and Caicos Standard Time TZOFFSETFROM:-0500 TZOFFSETTO:-0500 END:STANDARD BEGIN:STANDARD DTSTART:20181104T020000 RRULE:FREQ=YEARLY;UNTIL=20190101T050000Z;BYDAY=1SU;BYHOUR=2;BYMINUTE=0;BYMO NTH=11 TZNAME:Turks and Caicos Standard Time TZOFFSETFROM:-0400 TZOFFSETTO:-0500 END:STANDARD BEGIN:STANDARD DTSTART:20191103T020000 RRULE:FREQ=YEARLY;BYDAY=1SU;BYHOUR=2;BYMINUTE=0;BYMONTH=11 TZNAME:Turks and Caicos Standard Time TZOFFSETFROM:-0400 TZOFFSETTO:-0500 END:STANDARD BEGIN:DAYLIGHT DTSTART:19700308T020000 RRULE:FREQ=YEARLY;UNTIL=20150101T050000Z;BYDAY=2SU;BYHOUR=2;BYMINUTE=0;BYMO NTH=3 TZNAME:Turks and Caicos Daylight Time TZOFFSETFROM:-0500 TZOFFSETTO:-0400 END:DAYLIGHT BEGIN:DAYLIGHT DTSTART:20150308T020000 RRULE:FREQ=YEARLY;UNTIL=20160101T050000Z;BYDAY=2SU;BYHOUR=2;BYMINUTE=0;BYMO NTH=3 TZNAME:Turks and Caicos Daylight Time TZOFFSETFROM:-0500 TZOFFSETTO:-0400 END:DAYLIGHT BEGIN:DAYLIGHT DTSTART:20160101T000000 RRULE:FREQ=YEARLY;UNTIL=20170101T050000Z;BYHOUR=0;BYMINUTE=0;BYMONTH=1;BYMO NTHDAY=1 TZNAME:Turks and Caicos Daylight Time TZOFFSETFROM:-0500 TZOFFSETTO:-0500 END:DAYLIGHT BEGIN:DAYLIGHT DTSTART:20170101T000000 RRULE:FREQ=YEARLY;UNTIL=20180101T050000Z;BYHOUR=0;BYMINUTE=0;BYMONTH=1;BYMO NTHDAY=1 TZNAME:Turks and Caicos Daylight Time TZOFFSETFROM:-0500 TZOFFSETTO:-0500 END:DAYLIGHT BEGIN:DAYLIGHT DTSTART:20180311T020000 RRULE:FREQ=YEARLY;UNTIL=20190101T050000Z;BYDAY=2SU;BYHOUR=2;BYMINUTE=0;BYMO NTH=3 TZNAME:Turks and Caicos Daylight Time TZOFFSETFROM:-0500 TZOFFSETTO:-0400 END:DAYLIGHT BEGIN:DAYLIGHT DTSTART:20190310T020000 RRULE:FREQ=YEARLY;BYDAY=2SU;BYHOUR=2;BYMINUTE=0;BYMONTH=3 TZNAME:Turks and Caicos Daylight Time TZOFFSETFROM:-0500 TZOFFSETTO:-0400 END:DAYLIGHT END:VTIMEZONE BEGIN:VEVENT UID:040000008200E00074C5B7101A82E00800000000200C6FB26A58D901000000000000000 0100000009DA701809DD45B4284BAD692CD904C78 DTSTART;TZID=Turks And Caicos Standard Time:20230406T010000 DTEND;TZID=Turks And Caicos Standard Time:20230406T013000 CLASS:PUBLIC DESCRIPTION: DTSTAMP:20230317T045217Z PRIORITY:5 SEQUENCE:0 SUMMARY:2023/04/06 - Make Sure I Get Sunscreen TRANSP:OPAQUE BEGIN:VALARM ACTION:DISPLAY DESCRIPTION:This is an event reminder TRIGGER:-PT15M END:VALARM X-MICROSOFT-CDO-BUSYSTATUS:BUSY END:VEVENT END:VCALENDAR ``` Looks like this one, from back in 2016: https://github.com/aluxnimm/outlookcaldavsynchronizer/issues/107
kerem closed this issue 2026-02-25 20:31:30 +03:00
Author
Owner

@aluxnimm commented on GitHub (Apr 4, 2023):

Well our icalendar libraries has issues with exotic timezone definitions in VTIMEZONE, you just need to delete and recreate that appointment with a standard windows timezone definition for that location for example and it should go away.

<!-- gh-comment-id:1495512105 --> @aluxnimm commented on GitHub (Apr 4, 2023): Well our icalendar libraries has issues with exotic timezone definitions in VTIMEZONE, you just need to delete and recreate that appointment with a standard windows timezone definition for that location for example and it should go away.
Author
Owner

@JGKle commented on GitHub (Apr 4, 2023):

If this is a known/recurring issue that won't be fixed, seems like it should at least have a clear user-facing message to that effect. It took me awhile just to notice that it was consistently failing, and then to realize that it was always the same item. Also note that I didn't explicitly choose the timezone for the reminder - I was simply traveling, and that was the default thta Outlook selected, due to Windows being on that timezone. A simple pop-up warning like "You have a calendar item that is failing to sync due to its timezone. Please delete this item & recreate with a different timezone" would no doubt save users a lot of time & confusion.

<!-- gh-comment-id:1496081790 --> @JGKle commented on GitHub (Apr 4, 2023): If this is a known/recurring issue that won't be fixed, seems like it should at least have a clear user-facing message to that effect. It took me awhile just to notice that it was consistently failing, and then to realize that it was always the same item. Also note that I didn't explicitly choose the timezone for the reminder - I was simply traveling, and that was the default thta Outlook selected, due to Windows being on that timezone. A simple pop-up warning like "You have a calendar item that is failing to sync due to its timezone. Please delete this item & recreate with a different timezone" would no doubt save users a lot of time & confusion.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/outlookcaldavsynchronizer#371
No description provided.