"Unable to create the PISDK. PI Data References will not function" ERROR.

Discussion created by ChewCheeLim on May 22, 2012
Latest reply on May 23, 2012 by ChewCheeLim

Does anyone know why the below code (in yellow) generates this error?






System.ApplicationException was unhandled by user code


  Message=Unable to create the PISDK. PI Data References will not function.






       at OSIsoft.AF.Asset.DataReference.PIBaseDR.Initialize() in c:\Builds\AF\AF 2.4\Sources\PlugIns\DataReferences\AFDRpi\PIBaseDR.cs:line 423


       at OSIsoft.AF.Asset.DataReference.PIBaseDR.set_Attribute(AFAttribute value) in c:\Builds\AF\AF 2.4\Sources\PlugIns\DataReferences\AFDRpi\PIBaseDR.cs:line 255


       at OSIsoft.AF.Asset.DataReference.PIPointDR.set_Attribute(AFAttribute value) in c:\Builds\AF\AF 2.4\Sources\PlugIns\DataReferences\AFDRpi\PIPointDR.cs:line 429


       at OSIsoft.AF.Asset.AFDataReference.Initialize(AFAttribute attribute, AFPlugIn plugIn, Guid id, String configString) in c:\Builds\AF\AF 2.4\Sources\SDK\Asset\AFDataReference.cs:line 382


       at OSIsoft.AF.AFPlugIn.CreateDataReferenceInstance(AFObject context, String configString) in c:\Builds\AF\AF 2.4\Sources\SDK\AFPlugIn.cs:line 1153






Code Snippet:










            string[] saLvwItem = new string[2];
            foreach (AFAttribute attribute in allAttributes)
                saLvwItem[0] = attribute.Description;
                              //Figure out attributewhat kind of point it is..
 if (attribute.DataReference == null)
                    if (attribute.GetValue() == null)