eignert

Unexpected behavior of AFSDK when searching for AFElements by path

Discussion created by eignert on Nov 18, 2014
Latest reply on Nov 20, 2014 by Gregor

I’m currently encountering a rather strange behavior using the AFSDK (Version 2.6.1.6238).

 

The following C# code shows you an example:

 

 

 
//// Search AFElement by GUID
AFElement testElement = AFElement.FindElement(new PISystems()["zbghpi01-af"], new Guid("7e41c6ac-6e5d-11e4-9b38-b8ac6f2902a1"));
Console.WriteLine("testElement.UniqueID = {0}", testElement.UniqueID);
Console.WriteLine("testElement.GetPath() = {0}", testElement.GetPath());

//// Search the same element by its path
List<string> searchPaths = new List<string>() { testElement.GetPath() };
AFKeyedResults result = AFElement.FindElementsByPath(searchPaths, null);
Console.WriteLine("result.Count = {0}", result.Count); 

First we search an AFElement by the GUID and output the UniqueID and the Path to the Console to make sure it was found. Afterwards, we use the path of the found AFElement to search for it again and output the number of found elements.
Usually we would expect the count to always have a value of 1. In our case we get the output 0 which means the element is not found by its own path!? -> please see attachment.

 

The strange thing is that we have AFElements in our AFDatabase that have been created some time ago (with AF 2.5) and those AFElements are being found correctly with the same code.

 

Additional information: The Security on all elements in the AF-DB is the same and when testing this I had Admin-Rights to the AF-Server / Database. PSE shows all elements correctly.

 

I've sent this issue to the Techsupport (#594519) and got the information the AFSDK is supported through vCampus... So... does anyone have an Idea what could go wrong here?

 

BR, Thomas

Outcomes