salesagility / SuiteCRM-Outlook-Plugin

GNU Lesser General Public License v3.0
64 stars 69 forks source link

Deleting meeting in outlook throws exception #86

Closed eliassa closed 5 years ago

eliassa commented 5 years ago

Issue

When a meeting is deleted in outlook several COMExceptions is logged and some times prompted, and the meeting is never removed from the CRM calendar.

Also some JsonSerializationExceptions are often shortly after this.

Steps to Reproduce

  1. SyncMeetings is one-directional from Outlook to CRM.
  2. Start outlook with the plugin enabled.
  3. Create a new Meeting and wait for it to sync to CRM.
  4. Delete/cancel the meeting. (Some times i get prompted with the error, some times not)

Context

Logs

first exception

2018-11-13 15:23:25,161 | VSTA_Main | DEBUG | Outlook Kalender ItemRemove
2018-11-13 15:23:25,176 | VSTA_Main | DEBUG | Object has probably been deleted: -1698430710, The item has been moved or deleted.; HResult -1698430710
2018-11-13 15:23:25,192 | VSTA_Main | ERROR | Failed to handle item(s) removed from Kalender
System.Runtime.InteropServices.COMException (0x9EE4010A): The item has been moved or deleted.
   at Microsoft.Office.Interop.Outlook._AppointmentItem.get_UserProperties()
   at SuiteCRMAddIn.Extensions.AppointmentItemExtension.GetCrmId(AppointmentItem olItem) in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMAddIn\Extensions\AppointmentItemExtensions.cs:line 76
   at SuiteCRMAddIn.BusinessLogic.MeetingsSynchroniser.AddOrUpdateItemFromOutlookToCrm(SyncState`1 syncState) in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMAddIn\BusinessLogic\MeetingsSynchroniser.cs:line 187
   at SuiteCRMAddIn.BusinessLogic.AppointmentsSynchroniser`1.RemoveFromCrm(SyncState state) in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMAddIn\BusinessLogic\AppointmentsSynchroniser.cs:line 755
   at SuiteCRMAddIn.BusinessLogic.Synchroniser`2.RemoveDeletedItems() in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMAddIn\BusinessLogic\Synchroniser.cs:line 817
   at SuiteCRMAddIn.BusinessLogic.Synchroniser`2.Items_ItemRemove() in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMAddIn\BusinessLogic\Synchroniser.cs:line 592
Data:System.Collections.ListDictionaryInternal
HResult:-1629224694

second exception

2018-11-13 15:30:57,874 | 5  | ERROR | Item with CRMid a35d6447-c8dd-3043-bb6b-d16720a8c96f appears to be invalid (HResult -1490812662)
System.Runtime.InteropServices.COMException (0xA724010A): The item has been moved or deleted.
   at Microsoft.Office.Interop.Outlook._AppointmentItem.get_UserProperties()
   at SuiteCRMAddIn.BusinessLogic.MeetingsSynchroniser.CheckMeetingAcceptances() in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMAddIn\BusinessLogic\MeetingsSynchroniser.cs:line 150
Data:System.Collections.ListDictionaryInternal
HResult:-1490812662

3rd and 4th exception (may not be relevant, but appears shortly after the deletion failure)

2018-11-13 15:30:57,996 | 5  | DEBUG | CrmRestServer.CreatePostRequest:
    Content type: application/x-www-form-urlencoded; charset=utf-8
    Payload     method=get_entry_list&input_type=JSON&response_type=JSON&rest_data={"session":"ia687d9vlv8jkt5km60tha3jf1","module_name":"Meetings","query":"id = a35d6447-c8dd-3043-bb6b-d16720a8c96f","order_by":"date_entered DESC","offset":0,"max_results":"1000","deleted":false,"favorites":false}
2018-11-13 15:30:58,043 | 5  | DEBUG | Request to CRM: 
    URL: http://XXCRM-URLXX/api?Auth=XXXXXAUTH-TOKENXXXXXX
    Method: POST
    Payload: method=get_entry_list&input_type=JSON&response_type=JSON&rest_data=%7B%22session%22%3A%22ia687d9vlv8jkt5km60tha3jf1%22%2C%22module_name%22%3A%22Meetings%22%2C%22query%22%3A%22id+%3D+a35d6447-c8dd-3043-bb6b-d16720a8c96f%22%2C%22order_by%22%3A%22date_entered+DESC%22%2C%22offset%22%3A0%2C%22max_results%22%3A%221000%22%2C%22deleted%22%3Afalse%2C%22favorites%22%3Afalse%7D
    Decoded: method=get_entry_list&input_type=JSON&response_type=JSON&rest_data={"session":"ia687d9vlv8jkt5km60tha3jf1","module_name":"Meetings","query":"id = a35d6447-c8dd-3043-bb6b-d16720a8c96f","order_by":"date_entered DESC","offset":0,"max_results":"1000","deleted":false,"favorites":false}
2018-11-13 15:30:58,043 | 5  | DEBUG | Response from CRM: []
2018-11-13 15:30:58,121 | 5  | WARN  | Tried calling 'get_entry_list' with parameter '{ session = ia687d9vlv8jkt5km60tha3jf1, module_name = Meetings, query = id = a35d6447-c8dd-3043-bb6b-d16720a8c96f, order_by = date_entered DESC, offset = 0, select_fields = , link_names_to_fields_array = , max_results = 1000, deleted = False, favorites = False }', timeout is 300000ms
2018-11-13 15:30:58,121 | 5  | ERROR | Failed calling 'get_entry_list'
Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'SuiteCRMClient.RESTObjects.EntryList' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureArrayContract(JsonReader reader, Type objectType, JsonContract contract)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at SuiteCRMClient.CrmRestServer.DeserializeJson[T](String responseJson) in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMClient\CrmRestServer.cs:line 191
   at SuiteCRMClient.CrmRestServer.GetCrmResponse[T](String method, Object input) in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMClient\CrmRestServer.cs:line 108
Data:System.Collections.ListDictionaryInternal
HResult:-2146233088
2018-11-13 15:30:58,136 | 5  | ERROR | MS PerformIteration
Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'SuiteCRMClient.RESTObjects.EntryList' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureArrayContract(JsonReader reader, Type objectType, JsonContract contract)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at SuiteCRMClient.CrmRestServer.DeserializeJson[T](String responseJson) in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMClient\CrmRestServer.cs:line 191
   at SuiteCRMClient.CrmRestServer.GetCrmResponse[T](String method, Object input) in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMClient\CrmRestServer.cs:line 114
   at SuiteCRMClient.RestAPIWrapper.GetEntryList(String module, String query, Int32 limit, String order_by, Int32 offset, Boolean getDeleted, String[] fields, Object linkNamesToFieldsArray) in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMClient\RestAPIWrapper.cs:line 578
   at SuiteCRMAddIn.BusinessLogic.AppointmentsSynchroniser`1.HandleItemMissingFromOutlook(SyncState`1 syncState) in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMAddIn\BusinessLogic\AppointmentsSynchroniser.cs:line 673
   at SuiteCRMAddIn.BusinessLogic.MeetingsSynchroniser.CheckMeetingAcceptances() in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMAddIn\BusinessLogic\MeetingsSynchroniser.cs:line 164
   at SuiteCRMAddIn.BusinessLogic.MeetingsSynchroniser.OtherIterationActions() in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMAddIn\BusinessLogic\MeetingsSynchroniser.cs:line 134
   at SuiteCRMAddIn.BusinessLogic.Synchroniser`2.PerformIteration() in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMAddIn\BusinessLogic\Synchroniser.cs:line 315
   at SuiteCRMAddIn.BusinessLogic.RepeatingProcess.<PerformRepeatedly>b__19_1() in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMAddIn\BusinessLogic\RepeatingProcess.cs:line 162
   at SuiteCRMAddIn.Robustness.DoOrLogError(ILogger log, Action action, String message) in C:\Users\eliauk\Documents\SuiteCRM-Outlook-Plugin\SuiteCRMAddIn\Robustness.cs:line 21
Data:System.Collections.ListDictionaryInternal
HResult:-2146233088

Your Environment

cameronblaikie commented 5 years ago

Hi There @eliassa We have resolved a memory leak in the action removing a meeting from the calendar, please upgrade to the latest version.