AnsweredAssumed Answered

PIPointList.LoadAttributes behaving differently on collective and single server?

Question asked by PetterBrodin on Dec 18, 2015
Latest reply on Jan 5, 2016 by PetterBrodin

I'm using the AF SDK to get a list of all available PIPoints and all available attributes on a server. Here's a simplified version of my code:

 

PIServers piServers = new PIServers();
PIServer server = piServers.DefaultPIServer;
server.Connect();


List<PIPoint> availablePiPoints = PIPoint.FindPIPoints(server, "*", false).ToList();


var results = new Dictionary<string, Dictionary<string, string>>();


IEnumerable<PIPoint> availablePiPointsReturned;


PIPointList piPoints = new PIPointList(availablePiPoints);


piPoints.LoadAttributes();


foreach (var piPoint in piPoints)
{
  var resultProperties = new Dictionary<string, string>();


  var pointProperties = piPoint.GetAttributes();

  foreach (var pointProperty in pointProperties)
  {
  resultProperties[pointProperty.Key] = pointProperty.Value.ToString();
  }
}


return results;

 

This works perfectly on my development machine and our development server, but on the client's server, I get an ArgumentOutOfRangeException on the piPoints.LoadAttributes():

 

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

   at System.ThrowHelper.ThrowArgumentOutOfRangeException()

   at OSIsoft.AF.PI.PIPointList.LoadAttributes(String[] names)

   at PiAFSDKTagDatasource.GetAvailableTags()

 

I've checked that the PI Data Archive version of both servers are the same (3.4.390.18) and that they have the same AF SDK DLL (2.7.5.7166).

 

At this point the only difference I can think of is that the production server is in a collective and that the development server is standalone.

 

Am I onto something here, or is there something else at play?

 

Edit: I added a check to see if the server is part of a collective before running LoadAttributes, and that seems to have worked. Of course that means that nothing will be cached, so there will be quite a few roundtrips to the server to get all the attributes. Is this expected behaviour or is it a bug?

Outcomes