Asp.Net Adding Object to Database Error: Collection was modified; enumeration operation may not execute


Question: How do you resolve Asp.Net Adding Object to Database Error: Collection was modified; enumeration operation may not execute?


Login to See the Rest of the Answer

Answer:
There is a chance that you are trying to instantiate a new DTO object that contains nested Objects if one of the nested objects does not have data or null values, this behaviour happens. Make sure that if you have any nested object list or any collection inside an object you are instantiating that you just leave those collections out. Do not try to populate them if you know at some point the collection might be null.







For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email Address[email protected]