AFElement.FindElement returns 'An item with the same key has already been added' error

Discussion created by seneschal on May 28, 2014
Latest reply on Jun 18, 2014 by seneschal

This one is odd. I am trying to utilize AFElement.FindElement(PISystem, GUID) and it is returning the error


"Unexpected Server error: 'An item with the same key has already been added.' Use Event Viewer to see the AF service log file for more information." 


Both of the parameters are properly populated.


This type of error usually only occurs during database Add attempts - why would it appear here?


Am I using it improperly? Is there another way to find an element based on its GUID?



AFElement afElement = AFElement.FindElement(Defines.AFDatabase.PISystem, Guid.Parse(element.ElementID)); /* <-- Exception here */
            if (afElement == null)
                LoggingWrapper.Logger.LogError("Could not locate element '" + element.ElementName + "' {" + element.ElementID + "} for autofetch.");