Code:
while (true)
{
foreach (ClassEntry ce in unorderedClasses)
{
if (ce.FullExtends == null || processedClassNames.Contains(ce.FullExtends))
{
// This class extends nothing, or is derived from one of the classes that were already processed.
// Append it to the list since it's safe to process now.
sortedList.Add(ce);
processedClassNames.Add(ce.FullClassName);
processedInThisIteration.Add(ce);
}
}
unorderedClasses.RemoveAll(processedInThisIteration);
if (processedInThisIteration.Count == 0)
{
if (!unorderedClasses.IsEmpty)
{
throw new MappingException(FormatExceptionMessage(unorderedClasses));
}
break;
}
processedInThisIteration.Clear();
}
If my assembly contains a class that has a FullExtends and that the FullExtends class is defined in an other assembly, then this class will never be processed and the exception will be thrown.