AnsweredAssumed Answered

Retrieving basic summaries in PI AF SDK

Question asked by ErikDeSmedt on Aug 31, 2016
Latest reply on Sep 6, 2016 by ErikDeSmedt



I am writing an application in PI AF SDDK which retrieves some basic summaries such as averages. Whenever I try to request an average a cryptic error message appears. However, if I perform another query before requesting the average everything works fine.


I would like to understand why this is happening and learn how can I avoid performing this seemingly spurious call?


//retrieve the required attribute


// Uncomment the next line to fix the code

// var test = attribute.Data.InterpolatedValue(new AFTime("*"), null);

IDictionary<AFSummaryTypes, AFValue> result1 = attribute.Data.Summary(timeRange, 




AFValue value = result1[AFSummaryTypes.Average];

Assert.IsTrue(value.IsGood, value.Value.ToString());

//When the line is uncommnented the test succeeds and the average is computed correctly

//When the line is commented out the test fails. A bad value with the following error message appers.

//Assert.IsTrue failed. System.Runtime.Serialization.SerializationException: Type 'OSIsoft.AF.Data.AFDataProvider+AFQueryDataProvider' in assembly 'OSIsoft.AFSDK, Version=, Culture=neutral, PublicKeyToken=6238be57836698e6' is not marked as serializable.