does entity framework or mysql provider swallows timeout exceptions on enumeration of result?!

Posted by Freddy Rios on Stack Overflow See other posts from Stack Overflow or by Freddy Rios
Published on 2010-05-05T23:51:27Z Indexed on 2010/05/05 23:58 UTC
Read the original article Hit count: 215

Filed under:
|
|
|

I'm trying to make sense of a situation I have using entity framework on .net 3.5 sp1 + MySQL 6.1.2.0 as the provider. It involves the following code:

Response.Write("Products: " + plist.Count() + "<br />");
var total = 0;
foreach (var p in plist)
{
//... some actions
    total++;
//... other actions
}
Response.Write("Total Products Checked: " + total + "<br />");

Basically the total products is varying on each run, and it isn't matching the full total in plist. Its varies widely, from ~ 1/5th to half.

There isn't any control flow code inside the foreach i.e. no break, continue, try/catch, conditions around total++, anything that could affect the count. As confirmation, there are other totals captured inside the loop related to the actions, and those match the lower and higher total runs.

I don't find any reason to the above, other than something in entity framework or the mysql provider that causes it to end the foreach when retrieving an item.

The body of the foreach can have some good variation in time, as the actions involve file & network access, my best shot at the time is that when it takes beyond certain threshold there is some type of timeout in the underlying framework/provider and instead of causing an exception it is silently reporting no more items for enumeration.

Can anyone give some light in the above scenario and/or confirm if the entity framework/mysql provider has the above behavior?

© Stack Overflow or respective owner

Related posts about entity-framework

Related posts about mysql