Hi Randall,
Can you please report this to support center so we can assign a dev to this?
We suspect the AllTypes property is leading to unecessary parsing that isn't releasing memory during the iteration, and in large projects you're feeling the hit. We will fix this, but as a work around, try code like this:
public static void GetTypeCountsForProject(ProjectElement proj, out int itemCounter, out int classCounter)
{
itemCounter = 0;
classCounter = 0;
System.Collections.ICollection liteElements = proj.ProjectSymbols.Values;
foreach (IElement element in liteElements)
if (element is ITypeElement)
{
itemCounter++;
if (element.ElementType == LanguageElementType.Class)
classCounter++;
}
}
The lite elements are something that we don't normally expose to plug-in developers -- they are a lightweight structure we use behind the scenes to support some of the heavier elements like LanguageElement and its descendants.