Bug in ResourcePool ? - Updating DataSources after the plot was removed from the ChartPlotter

Sep 3, 2015 at 10:00 PM
Hi there,

I have a project where the user can select which parameters to plot from different contexts. For this reason, different combinations of LineCharts are added and removed from the plotter at runtime. But the plots are displaying live data and additional points are coming in all the time.

After a LineChart was removed from the plotter with RemoveFromPlotter(), and the collection of data points is updated, an InvalidOperationException is thrown in ResourcePool.cs. ("Cannot release item that is already contained in pool.").

It is thrown by the Put(T item) method because an item is attempted to be added to the "pool" collection. The method actually checks if the item is already in the List and then throws the exception.

What is the purpose of ResourcePool?

I changed it from
int index = pool.IndexOf(item);
if (index != -1)
    throw new InvalidOperationException("Cannot release item that is already contained in pool.");
if (index == -1)
And now it is working in my test project.

Will that change cause any trouble somewhere else?

I hope someone with deep enough insight into d3 reads this and can help =D