AnsweredAssumed Answered

"Cannot access a disposed object" after calling GetValueArrays for AFValues

Question asked by Guilherme Ferreira Champion on Apr 7, 2016
Latest reply on Apr 8, 2016 by Guilherme Ferreira

Hi everyone!


I don't understand very well what the above mentioned error means, or how to avoid this object disposal.


I have a IEnumerable<AFValues> v_AFValueList as the return of PIPointList.InterpolatedValues

IEnumerable<AFValues> v_AFValuesList = v_PIPointList.InterpolatedValues(v_timeRange, v_timeSpan, null, true, v_pagingConfig);


Then I use the first AFValues of the IEnumerable for calling GetValueArrays

AFValues v_firstAFValues = v_AFValuesList.ElementAt(0);
v_firstAFValues.GetValueArrays(out v_arrayAFValues, out v_arrayTimeStamps, out v_arrayStatus);


After that, I can't access the v_AFValueList anymore, getting the "Cannot access a disposed object".

foreach (AFValues v_AFValues in v_AFValuesList)


What does it mean exactly? Anytime I use any element of an IEnumerable, I automatically dispose the latter? How could I avoid the disposal?


Best regards!