AnsweredAssumed Answered

Why is InterpolatedValues output disposed of so quickly?

Question asked by gfmalek on Jun 10, 2020
Latest reply on Jun 11, 2020 by gfmalek

Below is a code snippet.  The first Console.Writeline Statement returns the name of the tag associated with the first AFValues collection within the result variable (there are three AFValues, one for each of three PI tags).  The second Console.Writeline statement throws a System.ObjectDisposedException: 'Cannot access a disposed object'.


Why is this variable automatically disposed of, and why is it disposed of so soon?


IList<PIPoint> taglist = PIPoint.FindPIPoints(piServer: piServer, names: taglistnames);
PIPointList taglistproper = new PIPointList(taglist);
IEnumerable<AFValues> result = taglistproper.InterpolatedValues(tr, tspan, null, false, config);


Let me know if I need to provide more details.  I do not feel there is a problem with the way I defined the variables that serve as inputs to the InterpolatedValues call, which is why I did not include their declarative statements.