I'm getting a null exception while iterating over a collection of non nullable objects.
List<ReconFact> facts = new List<ReconFact>();
// ...populating facts
int count = 0;
foreach (var fact in facts)
{
Console.WriteLine(++count);
try
{
context = AddToContext(context, fact, count, 100, true);
}
catch (Exception e)
{
Console.WriteLine(e.Message); // Null Exception Raised at some point
}
}
How is that possible ? I didn't know that iterating over a list could provide null elements is that a normal behaviour ? Is it possible to add a null item when the list is populated ?