Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Error : Collection was modified; enumeration operation may not execute #8414


User avatar
0
troyfernando created
var estimateSubPortions = from o in pagedAndFilteredEstimateSubPortions
                                          select new GetEstimateSubPortionForViewDto()
                                          {
                                              EstimateSubPortion = new EstimateSubPortionDto
                                              {
                                                  EstimateHdId = o.EstimateHdId,
                                                  PortionId = o.PortionId,
                                                  ItemNo = o.ItemNo,
                                                  SubPortDesc = o.SubPortDesc,
                                                  Area = o.Area,
                                                  TotalMaterials = o.TotalMaterials,
                                                  TotalLabor = o.TotalLabor,
                                                  TotalOthMat = o.TotalOthMat,
                                                  Id = o.Id
                                              }
                                          };

 var totalCount = await filteredEstimateSubPortions.CountAsync();

**** error here below first time it loads afterwards it's ok *****


return new PagedResultDto<GetEstimateSubPortionForViewDto>(
                    totalCount,
                    await estimateSubPortions.ToListAsync()
                );

26 Answer(s)