Collection Was Modified Error in WCF using Organization Service.

Forum Post: Change the Filter On option on Opportunity Associated View for Account form

Hi Team,

We do have Dynamics CRM 2016 on-prem implementation. There is webapi service which consumes Dynamics Organization service.

On local development environment we do not get any error, but when we deploy it on test or production environment we get ‘Collection was modified; enumeration operation may not execute’ error.

We get this error even for simple retrieve (which does not include any list or entitylist).

Code which returns error

context.Opportunity.FirstOrDefault(d => d.opportunityid == oppId); 

context.OrganizationService.Retrieve(incident.EntityLogicalName, incidentId, columnset).ToEntity<incident>()

Any inputs will be highly appreciated.

Source link

Leave a reply

Please enter your comment!
Please enter your name here