When developing Google Calendar related application on Windows Mobile, I have encountered this "Parsing Failed" exception. After debugging, I have found the cause of the problem. I record it here, so other people who are suffering this problem has found some information.
Problem description: The "Parsing Failed" exception was thrown when trying to get events from Google Calendar with CalendarService.Query(). The call stack looks like this: Message : Parsing failed InnerException : IndexOutOfRangeException StackTrace : At Google.GData.Client.AtomFeedParser.Parse() At Google.GData.Client.AtomFeed.Parse() At Google.GData.Client.Service.Query() At Google.GData.Calendar.CalendarService.Query() There is a similar case reported at: http://groups.google.com/group/google-calendar-help-dataapi/browse_thread/thread/0a5aa32b950cb9c5 This problem is very difficult to reproduce, it seems that it only occurs on certain OS configurations. I can reproduce the problem on my phone every time but I have never reproduce this problem on the Device Emulator. I have solved the problem by adjusting the date format on mobile Regional Settings. However, after the adjustment, even I adjust the setting back to the original state, the problem cannot be reproduced any more. So I think this may have some relations to the OS itself. Problem Analysis: After debugging the Google Data API SDK, I found the exact place which an exception is thrown is: Google.GData.Extensions.When.CreateInstance() => when.startTime = DateTime.Parse(value); When the problem happens, this DateTime.Parse function will throw IndexOutOfRangeException even the value it is parsing is something innocent like "2009-03-26". I haven't dive further into this to see why this happens, but after I adjusted the regional settings, the problem has gone and never happen again. Suggestions: Consider to use a more specific method for date time parsing in Google Data API SDK, for example, add IFormatProvider and DateTimeStyles to this function. Or, just leave the problem as is, personally I think this may be a problem that Microsoft should consider to solve. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---
