singhace

AFAttribute.FindElementAttributes() never returns and eventually times out

Discussion created by singhace on Oct 25, 2010
Latest reply on Nov 19, 2010 by singhace

I've been trying to use the following code to return a list of AF attributes for an AF element, but I always get a timeout error.  The AF element passed to the FindElementAttributes() only has 3 or 4 levels of child AFElements (~ 15 total) and the total number of attributes is relatively low (i.e. less than 200).  I was able to get this method working if I create a new database, but I dont understand why this method would timeout with our production database, especially when I set fullSearchHierarchy to false and have maxCount = 10.

static void Main(string [] args) 
{

    string path = \\\\PIDEV06\\SPWR\\Sites\\M0010;

    try
    {
        AFElement elem = AFElement.FindObject(path) asAFElement;
        AFDatabase afdb = elem.Database;

        AFNamedCollectionList<AFAttribute> attributes = AFAttribute.FindElementAttributes(afdb, elem, "*", null, null, AFElementType.Any, "*", null, System.TypeCode.Empty, false, AFSortField.Name, AFSortOrder.Ascending, 10);
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
    }
}

Outcomes