In my Dispose method I am disposing everything a Dataset has as below:
foreach (DataTable myTable in this.Tables)
{
myTable.Dispose();
}
Here this.Tables is public DataTableCollection Tables { get; }
I am having around 56 tables in this.Tables when it comes near to this call.
It works fine for few tables but suddenly it throws:
System.InvalidOperationException: Collection modified error
I am not sure why is this happening.
I tried to search for this exception a lot but i could not fine why it is breaking in my application.
May be because of threading? or I need to convert it to a list?