torsteins

AFAttribute.GetValue() throws PIException

Discussion created by torsteins on Nov 26, 2014
Latest reply on Nov 26, 2014 by torsteins

I'm having a small piece of code retrieving data from attributes. For some of the attributes the PIPoint is not correctly specified in AF, and the code throws an exception when I try to call GetValue() on these attributes. My question is - Is it possible to catch the exception and move on..? I don't want to care about whats specified and not in AF, i just want the value if it's there... My problem is that no matter what I try i'm not able to catch the exception, its just terminating the thread with error:

 

An exception of type 'OSIsoft.AF.PI.PIException' occurred in OSIsoft.AFSDK.dll but was not handled in user code

 

Additional information: PI Point not found 'xx.xxx.xx'.

 

 

 

try
{
  this.data.Add(afAttribute.Name, afAttribute.GetValue().Value.ToString());
}
catch (PIException e)
{
  this.data.Add(attribute.Name, "N/A");
}

Outcomes