In my application, I have a background thread that performs calculations and pushes the resultant ILnumerics arrays to the view. I am having issues with ILNumerics arrays getting disposed off when I trigger the view update function with Control.BeginInvoke.
Are there any specific function rules to follow when passsing ILArrays as input arguments to BeginInvoke delegate?
Here is my sample code.
void IMainView.UpdateSpectrumData(ILInArray<float> wfmData)
{
if (InvokeRequired)
{
BeginInvoke(new MethodInvoker(() => AddWfmToView(wfmData)), new object[] { wfmData });
}
else
{
AddWfmToView(wfmData);
}
}
}
void AddWfmToView(ILInArray<float> wfmData)
{
using(ILScope.Enter(wfmData))
{
// update panel
}
}