OxleyCreek

Unhandled exception when calling AFAttribute.RawPIPoint

Discussion created by OxleyCreek on Apr 26, 2012
Latest reply on Oct 29, 2012 by rdavin

The try...catch blocks in my code snippet below do not catch the exception that is generated when the RawPIPoint is null. Can anyone tell me why the exception is not being caught by my code?

 

Also I cannot find any reference to OSIsoft.AF.Asset.DataReference.TagException - where does it live?

 

 

 

 

 

Thanks Michael Jones 

foreach AFAttribute attrib in el.Attributes)
{
try
{
if (attrib.RawPIPoint != null)
{
string val = attrib.GetValue().Value != null ? attrib.GetValue().Value.ToString() : "";
string uom = attrib.DefaultUOM != null ? attrib.DefaultUOM.ToString() : "None";
dgv.Rows.Add(attrib.Name,"", val, uom);
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message + " " + ex.StackTrace);
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}

OSIsoft.AF.Asset.DataReference.TagException was unhandled by user code
  Message=Cannot retrieve PI Point 'GQPS00_AUX.BCS_CHG01_sUnderVol' for attribute 'Assets\Generation\Quarantine\Balance of Plant\Auxiliary Systems\Battery And Charger System\QPS-1A-LBA-BYC-003\Control System Tags|G1.L27BLN2_ALM'.
  Source=OSIsoft.AF.Asset.DataReference.PIPoint
  StackTrace:
       at OSIsoft.AF.Asset.DataReference.PIBaseDR.CheckBaseConfig() in c:\Builds\AF\AF 2.4\Sources\PlugIns\DataReferences\AFDRpi\PIBaseDR.cs:line 1515
       at OSIsoft.AF.Asset.DataReference.PIPointDR.CheckConfig() in c:\Builds\AF\AF 2.4\Sources\PlugIns\DataReferences\AFDRpi\PIPointDR.cs:line 807
       at OSIsoft.AF.Asset.DataReference.PIPointDR.get_RawPIPoint() in c:\Builds\AF\AF 2.4\Sources\PlugIns\DataReferences\AFDRpi\PIPointDR.cs:line 2697
  InnerException:

Outcomes